27
Running a DFT calculation in VASP ICME Fall 2012 Laalitha Liyanage [email protected] Codes

Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

  • Upload
    others

  • View
    49

  • Download
    7

Embed Size (px)

Citation preview

Page 2: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Density Funtional Theory • Hohenberg-Kohn theorems – Energy of the system is a unique functional of the

charge density – The correct ground state charge density minimizes the

energy functional and the resulting energy is the ground state energy.

• Exchange-Correlation functional:unknown – Approximations: LDA, GGA (PW91, PBE)

• Kohn-Sham scheme – Map interacting system to non-interacting system

Page 3: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

⦆Well-convergedを calculation • Choose XC functional

– Accuracy: LDA < GGA < Hybrid

• k-points in Brillouin zone – Do k-point convergence

• Accuracy increases with no. of k-points – For metals

• Choose a smearing technique – Tetrahedron method – good for very accurate total

energy calculations. – Gaussian, Methfessel-Paxton etc. – good for ionic

and geometric relaxations

• Energy cutoff – Controls completeness of planewave basis

set

• Pseudopotentials – Replaces nucleus and core electrons with

fixed effective potential

Page 4: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

What is VASP? • One of the software packages that uses DFT to solve the

quantum problem for materials – Uses periodic boundary conditions – Uses pseudopotential method with a plane waves basis set – Can model systems with maximum no. of atoms in the range of 100-200 – Commercial software package ~$5000 – Manual http://cms.mpi.univie.ac.at/vasp/vasp/PREC_tag.html

• Other DFT packages – (public license) – Quantum espresso (www.quantum-espresso.org) – Abinit( www.abinit.org)

– Siesta (http://icmab.cat/leem/siesta/)

Page 5: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

VASP input files • INCAR – User specified parameters that define the calculation

• Global break condition, Energy cutoff, Smearing, Ionic and geometric relaxation parameters

• POSCAR – Specifies the periodic simulation cell – Information regarding geometry of the system

• POTCAR – Pseudopotential (PP) file – Information on PP and XC functional

• KPOINTS – Defines k-point mesh

Page 6: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Our system

• Al • 4 atoms, fcc structure – Translational lattice vectors • a1 = (4.0; 0.0; 0.0) • a2 = (0.0; 4.0; 0.0) • a3 = (0.0; 0.0; 4.0)

– Basis vectors • 0.0; 0.0; 0.0 • 0.5; 0.0; 0.5 • 0.5; 0.5; 0.0 • 0.0; 0.5; 0.5

Page 7: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

POTCAR file with LDA XC

• For all elements VASP provides PP files in different flavors – US-PP, PAW-LDA, PAW-GGA, PAW-PBE

• If multiple species of atoms are in the system – Concatenate the same type of POTCAR files to make a single POTCAR file

• E.g. cat POTCAR_Al POTCAR_Mg >> POTCAR – The order of the POTCAR types should correspond to the ordering of atoms

in POSCAR

Page 8: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

POSCAR file

• In 】Direct‒ coordinates the positions of atoms are given as a fraction of translational lattice vectors. – In 】Cartesian‒ coordinates position of atoms is given in global coordinates.

• Universal scaling factor scales the volume of the unit cell – If negative value is given then it is taken as the volume of the unit cell.

• Order of atom types in POSCAR should be same with POTCAR

Page 9: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

INCAR file

• Minimal setup

– PREC : Controls the overall precision of the calculation

• Default: Normal – Standard calculation

– are sufficiently accurate with errors less than 1 meV/atom

• Low – quick and dirty calculations

• Accurate – High accuracy calculations

– ENCUT : Controls the no. of plane waves in the basis set

• Default: ENCUT=Largest ENMAX of POTCAR file

– Best if convergence test could be done

• For geometric relaxations (changing cell size) set ENCUT=1.3*ENMAXlargest

– LREAL: use of reciprocal/real space

• Default: .False. – uses in reciprocal space

• AUTO – recommended for systems more than 20 atoms. – uses real space

– ISMEAR

• Default: 1 – Methfessel-Paxton

• -5: Tetrahedron method

Page 10: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

KPOINTS file • For Al bulk system For Al single atom

• k- point grid should be inversely propotional to the ratio of lattice vectors (else it will give rise to errors) – E.g. If the lattice vectors are a1=3 a2=9 a3=21 then k-point grid

should be 7:3:1 ratio

Page 11: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Comments on k-points and smearing

• Smearing – Guidelines for ISMEAR

• For semiconductors or insulators always use tetrahedron method (ISMEAR=-5) or if cell is too large use Gaussian smearing (ISMEAR=0)

• For relaxations in metals always use ISMEAR=1 – Never use ISMEAR > 0 for insulators and semiconductors.

• For very accurate total energy calculations (no relaxations in metals) use the tetrahedron method (ISMEAR=-5).

• k- point convergence – recommended to use even meshes (e.g. 8 × 8 × 8 ) for up to � = 8

• After that odd meshes are more efficient (e.g. 11 × 11 × 11)

– http://cms.mpi.univie.ac.at/vasp/vasp/Automatic_k_mesh_generation.html – http://cms.mpi.univie.ac.at/vasp/vasp/Number_k_points_method_smearing.html

#im-smear

Page 12: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Standard output of a VASP run: PREC=N

• N – iteration count • E – Total energy • dE – change of total

energy

• ncg – no. of evaluations of the Hamiltonian acting on WF

• rms – approximate error in WF • rms(c) – difference between

input and output charge density

Page 13: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Standard output of a VASP run: PREC=A

• No wrap-around errors • Energy difference ~ 0.00001eV = 0.01meV • Therefore PREC=Normal with EDIFF=1e-04 is accurate enough. • Data from stdout are written to OSZICAR file as well. • http://cms.mpi.univie.ac.at/vasp/vasp/stdout_OSZICAR_file.html

Page 14: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

OUTPUT files

• CONTCAR – Contains position of the system after the calculation

has completed

• OSZICAR – Contains data of electronic steps and ionic steps

• OUTCAR – Complete output of run including input file data.

• CHGCAR – Charge density of system after run

Page 15: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Bulk Relaxations: Setup • ISIF tag

– determines which degrees of freedom (ions, cell volume, cell shape) are allowed to change.

– To only optimize ionic positions with in the cell do ISIF=2

– To perform cell volume and cell shape optimization do ISIF=2

• NSW tag: Specifies the maximum no. of ionic steps – Default NSW = 0

• IBRION tag: determines how the ions are

updated and moved. – If away from minimum use IBRION = 2

(Conjugate -gradient) – If close to minimum use IBRION=1 (quasi-

newton) – http://cms.mpi.univie.ac.at/vasp/vasp/IBRI

ON_tag_NFREE_tag.html

• Since Al is metallic – Use ISMEAR = 1 for

relaxation run • ENCUT is increased to

1.3*ENMAX to accommodate cell volume change.

Page 16: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Bulk relaxation:Procedure 1. Using the relaxation setup INCAR do the first run

with ISMEAR=1 (since metallic) and ISIF=2/3

2. Next copy CONTCAR to POSCAR, clear output files (use ‘cleanvaspfiles’) and run again – For ISIF=2 second step is unnecessary

3. Final step: switch on tetrahedron method

(ISMEAR=-5) to get very accurate energies – NEVER use energies from a relaxation run if volume

change is allowed.

• http://cms.mpi.univie.ac.at/vasp/vasp/Accurate_bulk_relaxations_with_internal_parameters_one.html

Page 17: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Volumetric relaxation procedure

• Best method is to use do ionic relaxations (ISIF=2) at different volumes and plot energy vs volume curve. – Fit to equation of state and obtain equilibrium volume

and energy

– ‘evfit’program offers several equation of state equations which can be used for fitting purposes.

• At the end of relaxation (ISIF =2/3) – if converged to parameters specified stdout will say

Page 18: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Automated Energy-Volume curve • Shell script • Uses lattice parameters from 3.5 Å

to 4.5 Å ~ only 10 points – More points will increase

accuracy • Extracts

– Final volume/ion – Energy/atom – Time for calculation

• Makes 2 output files (2 columns) – Energy/ion for each lattice

parameter – Energy/ion for each volume/ion

• Calculation at each fixed volume could be static or only ionic relaxations.

Page 19: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Curve fitting

• Using ‘evfit’ program we fit the data to – Murnaghan’s equation of state

• From the fitting we derive – Equilibrium lattice constant, bulk

modulus, and energy per atom.

Page 20: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Automated k-point convergence test

• EV generation script is called for different k-point grids – 4x4x4, 8x8x8 and 11x11x11

• At each fixed volume static calculation is done

• Total cpu time for these grids is recorded

• From 4x4x4 grid to 11x11x11 grid the time taken quadruples

• Energy difference is – From 4x4x4 to 8x8x8 ~50 meV – Form 8x8x8 to 11x11x1 ~ 6 meV

Page 21: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

pbs script • To submit jobs to TALON or

RAPTOR you need a pbs command script – Make sure that total no. of

processors you request is used in your mpirun command • mpirun –np <nodes x ppn>

• When doing calculations over 20 atoms use cluster

For RAPTOR

For TALON

Page 22: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Surface energy calculations • First to very accurate bulk energy calculation

– Do k-point convergence to ~< 1meV • ⦆if you want to calculate surface energies within アー meV you should probably

increase the k-mesh till your energy is converged to 1 meVを -VASP – Do Volumetric and ionic optimizations to a high degree

(PREC=Accurate, EDIFF=1e-06)

• Next Setup surface calculation – Start with a system that has at least 5 layers of atoms and 5 layers of

vacuum. • Good rule of thumb: make system big enough that surface to surface distance is

at least 10 Å – applies for any defect (vacancy, interstitial, stacking fault)

– Do k-point convergence test • Since in one direction there is a vacuum and it is longer than other translational

lattice vectors set revelent k-point to 1 • For the other 2 directions start off with values used for bulk calculation and do

convergence

• Finally keeping the k-points and all other parameters fixed change no. of bulk and vacuum layers – Look for convergence of surface energy – Remember to divide by 2 since periodic boundary conditions give rise

to 2 surfaces

Page 23: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Most common mistakes • Considering energy difference from calculations

that has different energy-cutoffs – If ENCUT is not specified default is largest ENMAX of

POTCAR – If adsorption energy is considered • E.g. adsorption of O atom on Al (111), Al ENMAX = 240 eV

while Co ENMAX = 400 eV

• Considering energy difference from calculations with two different k-point grids

• Please read – http://cms.mpi.univie.ac.at/vasp/vasp/most_important

_parameters_source_errors.html

Page 24: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

How to validate results • Increase cutoff – Recommended to set ENCUT by

hand – Change to PREC=Accurate

• Increase no. of k-points • Increase slab thickness for

surface energy and adsorption energy calculations

• Increase the size of the supercell for defects – To remove interaction of defect

with defect due to periodic boundary condition

Page 25: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Homework 1 • Each group will use different XC functional

– LDA, GGA-PW 91 and GGA-PBE • DFT calculations

– Energy-volume curves – Elastic constants – Vacancy formation energy – Interstitial formation energy (Both octahedral and tetrahedral) – Surface formation energy for (111), (110) and (001) surfaces – Extrinsic and intrinsic stacking fault energies – Plot generalized stacking fault curve

• List of properties of Aluminum going up to atomistic scale – Lattice constant, bulk modulus, elastic constants – Defect energies – vacancy formation and interstitial – Stacking fault energies – Intrinsic and extrinsic – Surface formation energies – E-V plot and GSF plot

• Divide calculations within group – Report on ICME website what/how you did calculations assigned to you. – Explain whether you got a 】well-converged‒ result – You will submit a report and do evaluations of your group members

Page 26: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

Visulization tools • VESTA – http://jp-minerals.org/vesta/en/ – Windows, Mac and Linux

• VMD – http://www.ks.uiuc.edu/Research/vmd/ – Windows, Mac and Linux

• OVITO – www.ovito.org/ – Windows and Linux

• XCrysDen – www.xcrysden.org/ – Mac and Linux

Page 27: Running a DFT calculation in VASP - Mississippi …icme.hpc.msstate.edu/mediawiki/images/d/d2/LS14_VASP.pdfWhat is VASP? • One of the software packages that uses DFT to solve the

References

• VASP documentation – http://cms.mpi.univie.ac.at/vasp/vasp/

• VASP workshop slides – http://cms.mpi.univie.ac.at/vasp-

workshop/slides/documentation.htm

• VASP tutorial @ ugent – http://users.ugent.be/~devpouck/dlstuff/VAPS_tutorial

11_01_2010.pdf