Algorithms for Total Energy and Forces in Condensed-Matter DFT codes

advertisement
Algorithms for Total Energy and Forces
in Condensed-Matter DFT codes
IPAM workshop “Density-Functional Theory Calculations for
Modeling Materials and Bio-Molecular Properties and Functions”
Oct. 31 – Nov. 5, 2005
P. Kratzer
Fritz-Haber-Institut der MPG
D-14195 Berlin-Dahlem, Germany
DFT basics
Kohn & Hohenberg (1965)
For ground state properties, knowledge of the electronic density r(r) is
sufficient. For any given external potential v0(r), the ground state energy
is the stationary point of a uniquely defined functional
Ev0 [ r ]  F[ r ]   dr r (r )v0 (r )
Kohn & Sham (1966)
[ –2/2m + v0(r) + Veff[r] (r) ] Yj,k(r) = ej,k Yj,k(r)
in daily practice:
Veff[r] (r) Veff(r(r))
Veff[r] (r) Veff(r(r), r(r) )
r(r) = j,k | Yj,k( r) |2
(LDA)
(GGA)
Outline
• flow chart of a typical DFT code
• basis sets used to solve the Kohn-Sham equations
• algorithms for calculating the KS wavefunctions and KS
band energies
• algorithms for charge self-consistency
• algorithms for forces, structural optimization and
molecular dynamics
initialize charge density
initialize wavefunctions
construct new charge density
for all k
determine wavefunctions spanning the occupied space
determine occupancies of states
no
no
yes
forces converged ?
move ions
energy converged ?
no
yes
static run
STOP
yes
relaxation run or molecular dynamics
forces small ?
yes
STOP
DFT methods for Condensed-Matter Systems
• All-electron methods
1) ‘frozen core’ approximation
projector-augmented
wave (PAW) method
2) fixed ‘pseudo-wavefunction’ approximation
• Pseudopotential / plane wave method:
only valence electrons (which are involved in chemical bonding)
are treated explicitly
Pseudopotentials and -wavefunctions
• idea: construct ‘pseudo-atom’ which has the valence
states as its lowest electronic states
• preserves scattering properties
and total energy differences
• removal of orbital nodes makes
plane-wave expansion feasible
• limitations: Can the pseudo-atom
correctly describe the bonding in
different environments ?
→ transferability
Basis sets used to represent wavefuntions
1. All-electron: atomic orbitals + plane waves in interstitial region
(matching condition)
LCAOs
PWs
LCAOs
LCAOs
LCAOs
2. All-electron: LMTO (atomic orbitals + spherical Bessel function
tails, orthogonalized to neighboring atomic centers)
3. PAW: plane waves plus projectors on radial grid at atom centers
(additive augmentation)
4. All-electron or pseudopotential: Gaussian orbitals
5. All-electron or pseudopotential: numerical atom-centered
orbitals
6. pseudopotentials: plane waves
Implementations, basis set sizes
implementation
(examples)
bulk
compound
surface,
oligo-peptide
1
WIEN2K
~200
~20,000
2
TB-LMTO
~50
~1000
3
CP-PAW, VASP, abinit
100..200
5x103…5x105
4
Gaussian,
Quickstep, …
50-500
103…104
5
Dmol3
~50
~1000
6
CPMD, abinit, sfhingx,
FHImd
100..500
104…106
Eigenvalue problem: pre-conditioning
• spectral range of H: [Emin, Emax]
in methods using plane-wave basis functions dominated by
2 2
E
~
E


kcut (2me )
kinetic energy;
max
cut
• reducing the spectral range of H: pre-conditioning
H → H’ = (L†)-1(H-E1)L-1 or
H → H’’ = (L†L)-1(H-E1)
C:= L†L ~ H-E1
• diagonal pre-conditioner (Teter et al.)
16 x 4  8 x 3  12 x 2  18 x  27
C
;
3
2
8 x  12 x  18 x  27
x  Tˆ / Ecut
Eigenvalue problem: ‘direct’ methods
• suitable for bulk systems or methods with atomcentered orbitals only
• full diagonalization of the Hamiltonian matrix
• Householder tri-diagonalization followed by
– QL algorithm or
– bracketing of selected eigenvalues by Sturmian sequence
→ all eigenvalues ej,k and eigenvectors Yj,k
• practical up to a Hamiltonian matrix size of ~10,000
basis functions
Eigenvalue problem: iterative methods
• Residual vector Rm  (H  e mS)Ym
• Davidson / block Davidson methods
(WIEN2k option runlapw -it)
– iterative subspace (Krylov space)
– e.g., spanned by joining the set of occupied states {Yj,k} with
pre-conditioned sets of residues {C―1(H-E1) Yj,k}
– lowest eigenvectors obtained by diagonalization in the
subspace defines new set {Yj,k}
Eigenvalue problem: variational approach
• Diagonalization problem can be presented as a minimization
problem for a quadratic form (the total energy)
Etot   Y j ,k | T  Vion  VHartree  Vxc | Y j ,k  Eionion
(1)
j .k
Etot   e j ,k  EHartree  EHartree  Eionion
(2)
• typically applied in the context of very large basis sets (PP-PW)
• molecules / insulators: only occupied subspace is required
→ Tr[H ] from eq. (1)
1


f

exp(
e
/
k
T
)

1
i ,k
i ,
B
• metals:  fi ,ke i ,k
→ minimization of single residua required
j .k
Algorithms based on the variational principle
for the total energy
• Single-eigenvector methods: residuum minimization, e.g. by
Pulay’s method
• Methods propagating an eigenvector system {Ym}:
(pre-conditioned) residuum is added to each Ym
– Preserving the occupied subspace
(= orthogonalization of residuum to all occupied states):
• conjugate-gradient minimization
• ‘line minimization’ of total energy
Additional diagonalization / unitary rotation in the occupied subspace
is needed ( for metals ) !
– Not preserving the occupied subspace:
• Williams-Soler algorithm
• Damped Joannopoulos algorithm
Conjugate-Gradient Method
• It’s not always best to follow straight the gradient
→ modified (conjugate) gradient
m 
R (m) | R (m)
R ( m1) | R ( m1)
d ( m )  R ( m )   m d ( m 1)
• one-dimensional mimimization of the total
energy (parameter f j )
Yj(i 1)  cos f j Yj(i )  sin f j d (ji )
Charge self-consistency
Two possible strategies:
• separate loop in the hierarchy (WIEN2K, VASP, ..)
• combined with iterative diagonalization loop (CASTEP,
FHImd, …)
lines of
fixed r
‘charge
sloshing’
Two algorithms for self-consistency
construct new charge density
and potential
construct new charge density
and potential
iterative diagonalization step
of H for fixed r
{Y(i-1)}→ {Y(i)}
No
(H-e1)Y<d ?
No
Yes
Yes
No
|| Y(i) –Y(i-1) ||<d ?
|| r(i) –r(i-1) ||=h ?
STOP
No
|| r(i) –r(i-1) ||=h ?
STOP
Achieving charge self-consistency
• Residuum:
R[ r in ]   f j ,k Y j ,k  r in
2
j ,k
• Pratt (single-step) mixing:
• Multi-step mixing schemes:
r in(i 1)  r in(i )  R[ r in(i )]
r
( i 1)
in
r 
(i )
in
i
( j)

R
[
r
 j in ]
j i  N
– Broyden mixing schemes: iterative update of Jacobian J
J  1  c  (VHartree[ r ]  VXC [ r ]);
R[ r ]  J  ( r  r sc );
idea: find approximation to c during runtime
WIEN2K: mixer
– Pulay’s residuum minimization
1
j
A

A
lj
l
;
1
lk
l ,k
Alk  R[ r in( k ) ] | R[ r in( l ) ]
Total-Energy derivatives
ESCF (n  dn)  ESCF (n)  O(dn 2 )
• first derivatives
– Pressure
– stress
– forces
p   E V
 ij  E e ij
F   E R
Formulas for direct implementation available !
• second derivatives
– force constant matrix, phonons
Extra computational and/or implementation work needed !
Hellmann-Feynman theorem
• Pulay forces vanish if the calculation has reached selfconsistency and if basis set orthonormality persists
independent of the atomic positions
F   dE
dR
1st +
 
3rd
j ,k
dY j ,k
dR
| H | Y j ,k
term = F 
IBS
dY j ,k
dH
 Y j ,k |
| Y j ,k  Y j ,k | H |
dR
dR
  e j ,k d
j ,k
dR
Y j ,k | Y j ,k
• FIBS=0 holds for pure plane-wave basis sets (methods
3,6), not for 1,2,3,5.
Forces in LAPW
FF
HF
F
HF
F
core
  Y j ,k |
j ,k
F
Veff
R
IBS
| Y j ,k
F F
T
FAC
Eionion

R
Fcore    ncore (r )Veff (r )dr
FT   
j ,k
FAC
F
rMT d
0
Y j ,kTˆY j ,k dS  
rMT d
Y j ,kTˆY j ,k dS
Combining DFT with Molecular
Dynamics
• Born-Oppenheimer MD
• Car-Parrinello MD
move ions
move ions
construct new charge density
and potential
construct new charge density
and potential
{Y(i-1)}→ {Y(i)}
{Y(i-1)}→ {Y(i)}
|| Y(i) –Y(i-1) ||=0 ?
|| Y(i) –Y(i-1) ||=0 ?
|| r(i) –r(i-1) ||=0 ?
|| r(i) –r(i-1) ||=0 ?
Forces converged?
Forces converged?
Car-Parrinello Molecular Dynamics
• treat nuclear and atomic coordinates on the same footing:
generalized Lagrangian


 Y

L   Y
j ,k
j ,k  Etot Y j ,k , R 
j ,k
• equations of motion for the wavefunctions and coordinates
   HY   Y
Y
j ,k
  F
M R


j ,k

j ,n
n ,k
n



Y
Y
j ,k
j ,k  Etot Y j ,k , R 
• conserved quantity 
j ,k
• in practical application: coupling to thermostat(s)
Schemes for damped wavefunction dynamics
• Second-order with damping
  ( H  e )Y  Y
Y
j ,k
j ,k
j ,k
j ,k
numerical solution: integrate diagonal part (in the occupied
subspace) analytically, remainder by finite-time step integration
scheme (damped Joannopoulos),
orthogonalize after advancing all wavefunctions
• Dynamics modified to first order (Williams-Soler)
  d ( H  e )Y
Y
j ,k
j ,k
j ,k
 (i 1)  exp[ d  (Tˆ  V  e
Y
j ,k
avg
(i )
ˆ  V )Y ( i )
)]
Y

d

(
V
j ,k
j ,k
avg
j ,k
Comparison of Algorithms (pure plane-waves)
bulk semi-metal (MnAs), SFHIngx code
Summary
• Algorithms for eigensystem calculations: preferred
choice depends on basis set size.
• Eigenvalue problem is coupled to charge-consistency
problem, hence algorithms inspired by physics
considerations.
• Forces (in general: first derivatives) are most easily
calculated in a plane-wave basis; other basis sets
require the calculations of Pulay corrections.
Literature
• G.K.H. Madsen et al., Phys. Rev. B 64, 195134 (2001)
[WIEN2K].
• W. E. Pickett, Comput. Phys. Rep. 9, 117(1989) [pseudopotential
approach].
• G. Kresse and J. Furthmüller, Phys. Rev. B 54, 11169 (1996)
[comparison of algorithms].
• M. Payne et al., Rev. Mod. Phys. 64, 1045 (1992) [iterative
minimization].
• R. Yu, D. Singh, and H. Krakauer, Phys. Rev. B 43, 6411 (1991)
[forces in LAPW].
• D. Singh, Phys. Rev. B 40, 5428(1989) [Davidson in LAPW].
Download