Академический Документы
Профессиональный Документы
Культура Документы
Introduction :
VASP is a pre-packaged code that solves the Schrodinger Equation using appropriate
approximations for the energy and forces. DFT codes like VASP are a very powerful tool for
scientific research. However, you have to learn to frame your research questions around the
outputs that a DFT code will give you. This tutorial will focus on the VASP input and output
files, however the same ideas can be applied to any DFT code although they will have different
input/output. As J. Hafner et al (MRS Bulletin, Vol 31, Sepember 2006) says:
The successful application of DFT to a materials problem involves three distinct steps:
(1) translation of the engineering problem to a computable atomistic model, (2)
computation of the required physicochemical properties, and (3) validation of the
simulation results by confrontation with laboratory experiments.
For an atom N (N=any atom in the periodic table), find the most stable crystal structure.
For example: Set up Fe in FCC, BCC, and HCP crystal structure. Compare the final
energies for each structure to find the lowest energy crystal structure.
Can also do as a function of pressure
TMR (tunneling magnetoresistance) values (based on the s-DOS at the Fermi energy)
Amy Bengtson
7/13/16 Page 1
Formation Energies
Stable magnetic ordering
Amy Bengtson
7/13/16 Page 2
Amy Bengtson
7/13/16 Page 3
To set up a different structure, you create a different POSCAR file for that structure. For
example, if you had two atoms - both of different types, the basic idea of the POSCAR file
would look like:
name of file
lattice parameter
lattice vector 1
lattice vector 2
lattice vector 3
11
Direct
starting position for atom 1 (of type 1)
starting position for atom 2 (of type 2)
Note: VASP has periodic boundary conditions, so even though we are only specifying 2 atoms
above, VASP views it as a bulk sample. In order to make a surface, you have to add space for
vacuum into your POSCAR file.
Extra Practice:
To gain familiarity with POSCAR files, create the following POSCAR files:
1. FCC Iron
2. BCC Iron
3. BCC Co Fe with 25% Fe
4. BCC CoFe with 50% Fe using ABAB stacking along the 1 0 0 direction.
5. BCC CoFe with 50% Fe using AABB stacking along the 1 0 0 direction.
6. An FCC surface (for any atom you choose).
Any other group member that uses DFT codes will be able to tell you if your POSCAR files are
correct.
Amy Bengtson
7/13/16 Page 4
To choose the value for ENCUT, you need to use the ENMAX from the POTCAR. First, find
the ENMAX:
[amy@curie input_files]$ grep ENMAX POTCAR
ENMAX = 265.574; ENMIN = 199.180 eV
ENMAX = 282.841; ENMIN = 212.131 eV
Choose to use ENCUT = 1.5*(Max ENMAX )= 1.5* 282.841= 425
Note: Every time you use a new atom type, you have to check the ENMAX to make sure you
choose a large enough value.
Amy Bengtson
7/13/16 Page 6
Amy Bengtson
7/13/16 Page 7
11.573
0.247
12.545
0.
0.
22173
12
11.573
0.247
12.545
0.
0.
b. Look at the energies for each iteration and check your final energy (E0) and the
change in energy (dE) for each iteration:
grep E0 OSZICAR
You should see something like:
[amy@curie relax]$ grep E0 OSZICAR
1 F= -.83999076E+01 E0= -.84042268E+01 d E =-.839991E+01
2 F= -.11221178E+02 E0= -.11222856E+02 d E =-.282127E+01
3 F= 0.17310991E+02 E0= 0.17310750E+02 d E =0.257109E+02
4 F= -.11506800E+02 E0= -.11508030E+02 d E =-.310689E+01
c. Look at the volumes for each iteration:
grep vol OUTCAR
You should see something like:
[amy@curie relax]$ grep vol OUTCAR
volume/ion in A,a.u.
=
22.31
150.53
volume of cell :
44.61
volume of cell :
44.61
volume of cell :
27.03
volume of cell :
5.94
volume of cell :
25.15
volume of typ
1: 16.7 %
volume of typ
2: 16.7 %
d. Look at the pressures for each iteration (mostly to make sure nothing weird
happened). grep pressure OUTCAR
[amy@curie relax]$ grep pressure OUTCAR
external pressure = -229.03 kB Pullay stress =
external pressure = -259.23 kB Pullay stress =
external pressure = 18566.56 kB Pullay stress =
external pressure = -238.66 kB Pullay stress =
0.00 kB
0.00 kB
0.00 kB
0.00 kB
Amy Bengtson
7/13/16 Page 9
OUTCAR file:
The OUTCAR file contains the main output information including volume (in cubic Angstroms)
and pressure (in kBar - divide by 10 to get in units of GPa).
You will want to examine how volume and pressure change with each iteration:
[amy@curie relax]$ grep vol OUTCAR
volume/ion in A,a.u.
=
22.31
volume of cell :
44.61
volume of cell :
44.61
volume of cell :
27.03
volume of cell :
5.94
volume of cell :
25.15
volume of typ
1: 16.7 %
volume of typ
2: 16.7 %
150.53
0.00 kB
0.00 kB
0.00 kB
0.00 kB
Here you see the volume of the cell started at 44.61 Ang3 but ends at 25.15 Ang3. This make
sense because the lattice parameters given were for NaCl, not MgO, so we expect them to be too
large at the start, and VASP will relax to the lowest energy lattice parameters.
Notice that the pressure starts and ends slightly expanded.
Beware: In the second to last iteration the volume of the cell drops to 5.94 Ang3 and the
pressure increases to 1856 GPa!! (This is about 10 times greater than the pressures at the center
of the Earth!). Something weird happened in the relaxation here. You will want to restart from
the CONTCAR and re-relax the cell (see Rerunning from the CONTCAR file for details).
Amy Bengtson
7/13/16 Page 10
OSZICAR file:
The OSZICAR contains information about the energy of the cell at each iteration. You want to
make sure that the change in energy from one step to another is converging (dE). Notice that at
the second to last iteration dE increases drastically. This is another warning sign that we have to
run a second convergence run.
[amy@curie relax]$ grep E0 OSZICAR
1 F= -.83999076E+01 E0= -.84042268E+01 d E =-.839991E+01
2 F= -.11221178E+02 E0= -.11222856E+02 d E =-.282127E+01
3 F= 0.17310991E+02 E0= 0.17310750E+02 d E =0.257109E+02
4 F= -.11506800E+02 E0= -.11508030E+02 d E =-.310689E+01
CONTCAR file:
The CONTCAR is the final positions and is written out after each iteration. At the end of the
calculation, the CONTCAR will give the final relaxed positions and lattice parameters. Notice
how CONTCAR and POSCAR have essentially the same format. You can restart a calculation
from a CONTCAR file in order to further converge a calculation, which we are going to do in the
section Rerunning from the CONTCAR file.
You may want to visualize the CONTCAR (using similar methods as you would to visualize the
POSCAR file) to make sure it is still the same structure Rocksalt structure.
Another useful command is: convasp -data < CONTCAR
All CONTCAR information is in Angstroms.
CHG* files:
Contains the charge densities. You need these to run a density of states calculation (see wiki for
details).
DOSCAR files:
Contains the occupation information (for plotting DOS). See the wiki for details.
Amy Bengtson
7/13/16 Page 11
Amy Bengtson
7/13/16 Page 12
Kpoint Convergence:
The more kpoints you have, the more accurate your calculation will be; however it will also be
slower. You want to make sure you are using a large enough kpoint mesh that your calculation is
accurate but can still run in a timely manner, which is why we do a kpoint convergence test.
Lets use integration by parts as an analogy to explain how the kpoints work:
In integration by parts, the smaller boxes that you use to estimate the area under a curve the more
accurate your area estimation will be. It is the same idea with Kpoints the more kpoints, the
more accurate.
We are going to do a kpoint convergence with respect to Energy (E0) and volume. You should
also do a kpoint convergence with respect to any final quantity that you want.
Use the relaxed structure that we found above (in directory relax2) to do a relaxation with higher
kpoints in a new directory (kpoints5 would be a good choice for a directory name):
1. Set up your input files:
cp -r relax2/ kpoints5
cd kpoints5/
cp CONTCAR POSCAR (to start from the relaxed structure)
vi KPOINTS
change 4 4 4 to 5 5 5
cvf (remove all VASP files except for the input files)
Submit your submission script.
2. Repeat this for KPOINTS files with meshes from 2 2 2 up to 20 20 20.
3. Submit all the jobs to the queue.
4. When the jobs are finished, get the total energy, volume, and CPU time from the output
files for each kpoint mesh.
5. To get the total energy type: grep E0 OSZICAR and take the last E0 that is listed.
6. To get the total volume type: grep vol OUTCAR and take the last volume that is listed.
7. CPU time: cat the OUTCAR and look for "Total CPU time used". This is for you to see
the time difference between kpoint meshes.
8. In Excel, plot the energy vs. kpoint mesh (in eV/atom units) and volume vs. kpoint mesh.
For hints on setup, see the excel sheet attached with the tutorial.
Amy Bengtson
7/13/16 Page 13
9. For kpoint mesh vs. energy, find the kpoint mesh where the energy/atom changes less
than 1meV from the higher kpoint mesh. This is your converged kpoint mesh with
respect to energy.
10. For the kpoint mesh vs. volume, find the mesh where the volume/atom changes less than
0.01 Angstroms from the higher kpoint mesh. This is your converged kpoint mesh
with respect to volume.
11. Are these convergedc kpoint meshes the same? If not, use the larger mesh for the most
accuracy.
12. Using your plots, think through what the consequences would be for using a kpoint mesh
that was not converged and talk through your thoughts with another group member that
uses DFT codes.
13. Show your plots of energy vs. kpoint mesh and volume vs. kpoint mesh to another group
member that uses DFT to make sure they make sense.
Note: As a rule of thumb, if the structure is cubic (like Rocksalt), the 3 kpoint values must all be
the same. If the structure is not cubic, then the kpoints should be the opposite of the ratios of the
sides of the unit cell please ask me or any other group member if you run into this situation.
Danes convasp routine has a very useful tool for determining kpoint meshes vs. lattice
parameter: convasp -kmesh kptdens POSCAR (kptdens = total number of kpoints you want).
Note: after I find the correct KPOINT mesh, I usually use the CONTCAR from it and run a final
3rd relaxation run.
SUMMARY: You should always use the k-point mesh that gives you converged energies and
volumes. If you do not do a k-point convergence, you risk having inaccurate outputs (energies,
volumes), which could cause you to make false conclusions in your research.
NOTE: If you are interested in another value besides energy or volume (for example: TMR),
you should also do a k-point convergence vs. TMR value.
NOTE: After you have done k-point convergence, you may also want to do a ENCUT
convergence (sometimes you will need an ENCUT > 1.5*ENMAX, but not often).
TAKE IT FURTHER: If you really want to go above and beyond, find an experimental paper
on MgO and compare those lattice parameters to the lattice parameters you calculated with your
converged kpoint mesh. How close are the values?
Amy Bengtson
7/13/16 Page 14
0.0000
Amy Bengtson
7/13/16 Page 15
Future Work:
Now that you have see the basics of how to run VASP, here are some future exercises to get more
comfortable with VASP.
1. Run FeO as a spin polarized calculation. Find the relaxed lattice parameters for FeO and
the magnetic moment on each atom.
a. Fe is magnetic, so you will do a spin polarized calculation.
b. You can probably use the same converged kpoint mesh you found for MgO
c. Use the same input files but change them to be FeO and spin polarized.
d. You want the relaxed lattice parameters and magnetic moment on Fe and O.
2. Repeat the entire calculation with the LDA pseudopotentials instead of GGA. How do
your energies and volumes change? Why is this?
3. ???
Amy Bengtson
7/13/16 Page 16