Computational Lab 3
Periodic Boundary Conditions-Local Optimization of Bulk Gold and Gold surfaces with DFT
Part 1: Simulating a Bulk Material - Determining Lattice Constants
A critical part of using periodic boundary conditions is finding the optimal lattice constants (length of the unit cells).
This part of the lab shows you how to find the optimizal lattice vectors (perform box relaxation).
First create your lab3 directory under your home directory.
The starting files for this part are in the directory /home/fri/lab_files_2022/lab3/Au_cubic. Copy this directory to your ~/lab3
Au_cubic contains the starting files for a VASP calculation of the bulk FCC gold cubic cell.
The term bulk, means that the periodic boundary conditions are in the x,y and z directions (the materials is infinite in all directions). To view the structure type xyz POSCAR. To view more unit cells you can increase the numbers on the lefthand panel called Repeat x, y, and z.
Finding optimum lattice vectors by hand
-
You will need 8 directories for various VASP calculations with different and evenly spaced lattice constants, between 3.9 Å and 4.3 Å. Your starting directory has a lattice constant of 4.1 Å. Submit each job in its own directory.
Create 7 directories by duplicaitng your box4100. For example, you can do
cp -r box4100 box3900
.
Then edit the POSCAR in your box3900 with vim, and change the scaling factor (on line 2) from 4.1 to 3.9. Also change the .sub file and give it a discriptive job name.
Repeat this process for box size 3.95, 4.00, 4.05 ... 4.30.
-
Next, we can see what your results look like by plotting how energy changes with lattice constant with the script quadratic_fit.py in Au_cubic.
Edit the script to insert your data, execute the script to create "latticefit.png" and find the optimal lattice constant.You only need to change the values of the list "latticec" and "energy".
This script plots how the potential energy changes with lattice constant and fits it to a second order polynomial.
The script finds the optimal lattice constant by finding the minimum of the polynomial, then prints the value to standard output.
Finding optimum lattice vectors with VASP box relaxation
VASP will also solve for the optimal lattice constant automatically.
- Create a new directory and copy over all of the starting files for a VASP calculations (INCAR, POTCAR, POSCAR, KPOINTS, slurm_fri.sub). You can duplicate one of the existing calculations.
This file will include the starting lattice constants for your optimization. - Open the INCAR file. Change the line ISIF=0 to ISIF=3. This tells VASP to allow the lattice vectors to change.
-
Next, you will need to keep submitting the calculation until there is only one ionic step (i.e., when you type vef.pl, it shows only 1 step.). If there is one ionic step, you are done! Otherwise wrap up your previous run with vfin.pl.
The reason we have to keep running it until there is only 1 step is because as the calculation goes, every ionic step changes the box size. This changes how many plane waves is necessary to achieve the desired accuracy. The number of waves used is determined when the job started.
- When the box is relaxed, you can find your optimized lattice constants in the CONTCAR.