9

Click here to load reader

Refs on 1

  • Upload
    sedeagu

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 1/9

Practical calculations using first-principles QM

Convergence, convergence, convergence

Keith Refson

STFC Rutherford Appleton Laboratory

September 18, 2007

Results of First-Principles Simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Convergence 4

Approximations and Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Convergence with basis set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6Error Cancellation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Plane-wave cutoff convergence/testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Pseudopotentials and cutoff behaviour. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9FFT Grid parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Force and Stress. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Iterative Tolerances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12K-point convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Golden rules of convergence testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

Structural Calculations 15Solids, molecules and surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Convergence of Supercells for Molecules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Variable Volume Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Variable Volume Calculations -II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Summary 20Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

1

Page 2: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 2/9

Results of First-Principles Simulations

First-principles methods may be used for subtle, elegant andaccurate computer experiments and insight into the structureand behaviour of matter.

First principles results may be worthless nonsense

2 / 21

Synopsis

This aims of this lecture are

1. To use the examples to demonstrate how to obtain converged  results, ie  correct predictions from the theory.2. How to avoid some of the common pitfalls and to avoid computing nonsense.

Further reading: Designing meaningful density functional theory calculation in materials science - a primer  Anne EMattson et al. Model. Sim. Mater. Sci Eng. 13 R1-R31 (2005).

3 / 21

2

Page 3: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 3/9

Convergence 4 / 21

Approximations and Convergence

s “Every ab-initio  calculation is an approximate one”.s Distinguish physical approximations

x Born-Oppenheimerx

Level of Theory and approximate XC functionaland convergable, numerical approximations

x basis-set size.x Integral evaluation cutoffsx numerical approximations - FFT gridx Iterative schemes: number of iterations and exit criteria (tolerances)x system size

s Scientific integrity and reproducibility: All methods should agree answer to (for example) “What is lattice constant of silicon in LDA approximation” if sufficiently well-converged.

s No ab-initio  calculation is ever fully-converged!

5 / 21

Convergence with basis setBasis set is fundamental approximation to shape of orbitals. How accurate need it be?

s The variational principle  states that E 0 ≤<ψ|H|ψ><ψ|ψ>

so a more accurate  representation of the orbitals ψ arising froma more complete  basis set will always lower  the computed ground-state energy.

s corollary : Error in energy δE 0 ∝ δ|ψ|2.s Increase size and accuracy of plane-wave basis set by adding more plane waves with higher G (increase E cut).s Increase size and accuracy of Gaussian basis set by adding additional orbitals, sometimes called “diffuse” or

“polarization” functions. Ad-hoc because no single parameter to tune.s Whatever the basis set it is prohibitively expensive to approach full convergence.s Fortunately well converged properties  may frequently be computed using an incomplete basis.s Size of planewave basis set governed by single parameter cut off energy (in energy units) or

basis precision=COARSE/MEDIUM/FINE.s Though E  is monotonic  in E c it is not necessarily regular .

6 / 21

3

Page 4: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 4/9

Error Cancellation

s Consider energetics of simple chemical reaction Mg O(s) + H2O(g) → Mg(OH)2,(s)s Reaction energy computed as ∆E = E product −

PE reactants = E Mg(OH)2 − (E MgO + E H2O)

s Energy change on increasing E cut from 500→4000eVMg O -0.021eV H2O -0.566eV Mg(OH)2 -0.562eVConvergence error in ∆E  -0.030eV

s Errors associated with H atom convergence are similar on LHS and RHS and cancel in final result.s Energy differences  converge much faster than ground-state energy.s Always use same cutoff for all reactants and products.

7 / 21

Plane-wave cutoff convergence/testing

Properties of a plane-wave basis.

s Cutoff determines highest representable spatial Fourier component of density.s Energy differences  converge faster than total energies. Electron density varies most rapidly near nuclei, where it

influences bonding very weakly.

n(r)

rAtom 1 Atom 2

s E cut (and Gmax) depend only on types  of atoms, not numbers.s Simulation cutoff is maximum of individual elements/pseudopotentials.s Required cutoff is system-independent  but not property-independent .

8 / 21

4

Page 5: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 5/9

Pseudopotentials and cutoff behaviour

s With efficient pseudopotentials rate  of convergence with cutoff isnot always smooth.

s Can get plateaus or other non-asymptotic behaviours Sometimes cause is over-optimization of the pseudopotential too low

a desired cutoff.s In cases with this behaviour can choose criterion for convergence

energy to be plateau values.s Absolute energy convergence is rarely desirable. Force and stress 

convergence is much more useful criterion.

s

(Example is not  a pseudpotential from the CASTEP database)

0 50 100 150 200

Ecut

(Ry)

0

0.05

0.1

   K   i  n  e   t   i  c  e  n  e

  r  g  y  e  r  r  o  r  p  e  r  e   l  e  c   t  r  o  n   (  e   V

   )

2s2p

KE convergence for O

9 / 21

FFT Grid parameters

Some optimizations and tweaks of FFT grid dimensions ...

s FFT grid should be large enough to accommodate all G-vectors of density, n(r), within cutoff: G ≤ 2GMAX.s Guaranteed to avoid ”aliasing” errors in case of LDA and pseudopotentials without additional core-charge density.s In practice can often get away with 1.5GMAX or 1.75GMAX with little error penalty for LDA without core or

augmentation charge.s GGA XC functionals give density with higher Fourier components, and need 1.75GMAX - 2GMAX

s Finer grid may be needed to represent USP augmentation charges or core-charge densities.s CASTEP incorporates a second, finer grid for charge density to accommodate core/augmentation charges while using

GMAX for orbitals.s Set by either parameter fine grid scale (multiplier of GMAX ) or fine gmax (inverse length GFINE)s fine gmax is property of pseudopotential and transferable to other cells but fine grid scale is not.s (Rarely) may need to increase fine grid scale for DFPT phonon calculations using GGA functionals for acoustic

sum rule to be accurately satisfied.

10 / 21

5

Page 6: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 6/9

Force and Stress

Frequently need to find crystal structure at mechanical equilibrium.

s Given guessed or exptl. initial structure, seek local minimum of Born-Oppenheimer energy surface generated by K-Sfunctional.

s Energy minimum implies forces are zero but not  vice versa.

s CASTEP provides for “geometry optimization” usingquasi-newton methods.

s Need to worry about accuracy  of forces.s Forces usually converge at lower cutoff  than total energy

because density in region of nucleus unimportant.

400 500 600 700 800 900E

cut(eV)

-0.1

-0.08

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

0.08

0.1

   C  o  n  v  e  r  g  e  n  c  e  e  r  r  o  r

∆E (eV)

∆F (eV/A)

∆P/1000 (GPa)

∆P/100 (inc FSBC)

Cut-off convergence test

cubic ZrO2

s different physical quantities converge at different rates.s Always test convergence specifically of  quantities of importance to your planned calculation

11 / 21

Iterative Tolerances

s How to control the iterative solvers ?s Parameter elec energy tol specifies when SCF energy converged.s Optimizer also exits if max cycles reached – always check that it 

really did converge .s How accurate does SCF convergence need to be?

s Energetics: same accuracy of result.s Geometry/MD: much smaller energy  tolerance needed to converge

forces.s Cost of higher tolerance is only a few additional SCF iterations.s Coming soon to a code near you – elec force tol to exit SCF

using force convergence criteria

s Inaccurate forces are common cause of geometry optimization failure.

12 / 21

6

Page 7: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 7/9

K-point convergence

Brillouin Zone sampling is another important convergence issue. Usually set in <seed>.cell with keywordkpoint mp grid p q r with optional offset kpoint mp offset.

s Convergence is not variational and frequently oscillates.s Even simple metals like Al need dense meshes for primitive cell.s Finite-temperature smearing  can accelerate convergence, but

must extrapolate the result back to 0K.s In case of insulators some k-point error cancellation occurs but

only between identical  simulation cells.Consequently comparative phase stability energetics and sur-face energetics frequently demand high degree of k-point con-vergence.

0 5 10 15 20 25 30Monkhorst-Pack q

-56.42

-56.41

-56.4

-56.39

-56.38

-56.37

-56.36

   E  n  e  r  g  y   (  e   V   )

-56.42

-56.41

-56.4

-56.39

-56.38

-56.37

-56.36

   E  n  e  r  g  y   (  e   V   )

Al k-point convergence testSmear=0.08, a0=4.04975, PBE, Ec=160eV

13 / 21

Golden rules of convergence testing

1. Test PW convergence on small  model system(s) with same elements.2. Testing requires going to unreasonably high degree of convergence, so calculations could be expensive. Test one 

parameter at a time .3. Use knowledge of transferability of PW cutoff and fine gmax.4. Don’t be fooled into choosing too high a plane-wave cutoff when you are really just converging fine FFT grid. Check

fine gmax for USPs.5. Use physical ∆k spacing to scale k-point sampling from small system to large.6. Use forces , stresses  and other cheap properties as measure of convergence.7. May need small number of tests on full system and final property of interest (eg dielectric permittivities are very

sensitive to k-point sampling).8. Write your convergence criteria in the paper, not just “250eV cutoff and 10 k-points in IBZ”.9. Convergence is achieved when value stops changing with parameter under test, NOT when the calculation exceeds

your computer resources and NOT when it agrees with experiment.

14 / 21

7

Page 8: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 8/9

Structural Calculations 15 / 21

Solids, molecules and surfaces

Sometimes we need to compute a non-periodic system with a PBC code.

s Surround molecule by vacuum space to model using periodic code.s Similar trick used to construct slab for surfaces.s Must include enough vacuum space that periodic images do not interact.s To model surface, slab should be thick enough that centre is “bulk-like”.s Beware of dipolar surfaces. Surface energy does not  converge with slab thickness.s When calculating surface energy, try to use same cell for bulk and slab to maximise error cancellation of k-point set.s Sometimes need to compare dissimilar cells – must use absolutely converged k-point set as no error cancellation.

16 / 21

Variable Volume Calculations

s

Two ways to evaluate equilibrium lattice parameter - minimum of energy or zero of stress.s Stress converges less well than energy minimum with cutoff.

s Incomplete basis error in stress approximated by Pulay stress correction.s “Jagged” E vs V curve due to discreteness of N PW. Can be corrected using Francis-Payne method (J. Phys. Conden.

Matt 2, 4395 (1990))s Finite-size basis corrections for energy and stress automatically computed by CASTEP.

17 / 21

8

Page 9: Refs on 1

8/2/2019 Refs on 1

http://slidepdf.com/reader/full/refs-on-1 9/9

Variable Volume Calculations -II

s Two possibilities for variable-cell MD or geometry optimization when using plane-wave basis set.s In fixed basis size  calculation, plane-wave basis N PW is constant as cell changes.s Cell expansion lowers  Gmax and K.E. of each plane wave, and therefore lowers effective E c.s Easier to implement but easy to get erroneous results.s Need very well-converged cutoff for success.s fixed cutoff   calculations reset basis for each volume, changing N PW but keeping Gmax and E c fixed.s This is almost always the correct method to use.

18 / 21

Summary 19 / 21

Summary

s Used with care, first principles simulations can give highly accurate predictions of materials properties.s Full plane-wave basis convergence is rarely if ever needed. Error cancellation ensure that energy differences, forces

and stress converge at lower cutoff.s Convergence as a function of adjustable parameters must be understood and monitored for the property of interest 

to calculate accurate results.s Don’t forget to converge the statistical mechanics as well as the electronic structure!s A poorly converged calculation is of little scientific value.

20 / 21

9