Making Electronic Structure Theory work Outline - Max

Making Electronic Structure Theory work
Ralf Gehrke
Fritz-Haber-Institut der Max-Planck-Gesellschaft
Berlin, 23th June 2009
Hands-on Tutorial on Ab Initio Molecular Simulations:
Toward a First-Principles Understanding of Materials Properties and Functions
Outline
Achieving Self-Consistency
Density Mixing
Linear Mixing, Pulay Mixer, Broyden Mixer
Electronic Smearing
Fermi-Dirac, Gaussian, Methfessel-Paxton
Preconditioning
Direct Minimization
Spin Polarization
Energy Derivatives
Local Atomic Structure Optimization
Outlook on Global Structure Optimization
Outline
Achieving Self-Consistency
Spin Polarization
Fixed Spin vs. Unconstrained Spin Calculation
Energy Derivatives
Local Atomic Structure Optimization
Outlook on Global Structure Optimization
Outline
Achieving Self-Consistency
Spin Polarization
Energy Derivatives
Atomic Forces
Numeric vs. Analytic Second Derivative
Vibrational Frequencies
Local Atomic Structure Optimization
Outlook on Global Structure Optimization
Outline
Achieving Self-Consistency
Spin Polarization
Energy Derivatives
Local Atomic Structure Optimization
Steepest Descent
Conjugate Gradient
Broyden-Fletcher-Goldfarb-Shannon (BFGS)
Cartesian vs. Internal Coordinates
Outlook on Global Structure Optimization
Outline
Achieving Self-Consistency
Spin Polarization
Energy Derivatives
Local Atomic Structure Optimization
Outlook on Global Structure Optimization
Achieving Self-Consistency
n
Density Mixing
0
in
h KS V eff nin
, r 2
2
h KS l l l nout
r 2l r l
R nin n out n in , r n in r n r n n d r ?
2
3
no
yes
finished !
Achieving Self-Consistency
Density Mixing
1 nin
nout
charge sloshing !
N2 = 1.1 Å PBE
Achieving Self-Consistency
n
Density Mixing
0
in
h KS V eff nin
, r 2
2
1 h KS l l l nin
nout
r 2l r Let's try some damping...
l
nout 1 nin
R nin n out n in , r n in r n r n n d r ?
2
3
no
yes
finished !
Achieving Self-Consistency
Density Mixing
1 nin
=0.5
N2 = 1.1 Å PBE
seems to work !
nout 1 nin
Achieving Self-Consistency
n
Density Mixing
0
in
but we can still do better...
h KS V eff nin
, r 2
2
1 h KS l l l nin
1
f nin , n in
2 , n in
1 j2 1 j2 ,, n out , n out , n out ,
nout
r 2l r l
R nin n out n in , r n in r n r n n d r ?
2
3
no
yes
finished !
Achieving Self-Consistency
n
Density Mixing
0
in
but we can still do better...
h KS V eff nin
, r 2
2
h KS l l l 1 nin
nout
r 2l r R nin n out n in , r n in r n r n n d r ?
2
3
yes
finished !
1
no
2 , n in
?
l
f nin , n in
,, n out , n out , n out ,
Achieving Self-Consistency
Density Mixing
N2 = 1.1 Å PBE
Achieving Self-Consistency
The Pulay Mixer
take more previous densities into account under the constraint of norm conservation
nopt
n in
in
P. Pulay, Chem. Phys. Lett. 73 (1980), 393
1
Achieving Self-Consistency
The Pulay Mixer
take more previous densities into account under the constraint of norm conservation
1
nopt
n in
in
main assumption: the charge density residual is linear w.r.t. to the density
R nopt
R
in
n R n in
in
P. Pulay, Chem. Phys. Lett. 73 (1980), 393
Achieving Self-Consistency
The Pulay Mixer
take more previous densities into account under the constraint of norm conservation
1
nopt
n in
in
main assumption: the charge density residual is linear w.r.t. to the density
R nopt
R
in
n R n in
in
coefficients are determined by minimizing the residual
R nopt R n opt 0
in
in
l
system of equations for P. Pulay, Chem. Phys. Lett. 73 (1980), 393
Achieving Self-Consistency
The Pulay Mixer
illustration in one dimension with two densities
RR
R R n R1R n 1in 2
2 in
R n R n R 1 R opt
in
opt
in
2
1
1 nin
2
2
n
2
n
opt
nin
opt
nin
nin
P. Pulay, Chem. Phys. Lett. 73 (1980), 393
Achieving Self-Consistency
The Pulay Mixer
illustration in one dimension with two densities
RR
R R n R1R n 1in 2
2 in
R n R n R 1 R opt
in
opt
in
2
1
1 nin
2
nin
to prevent trapping in subspace, add fraction of residual
n
true
x
3
nin
n1in opt
nin
2
nin
P. Pulay, Chem. Phys. Lett. 73 (1980), 393
nin
1 nopt
R nopt
in
in
Achieving Self-Consistency
The Pulay Mixer
additional preconditioner might accelerate convergence
1 in
n
A
preconditioning matrix: G
R nopt
n G
in
opt
in
k
2
k 2 k 20
long-range components of density changes are stronger damped than short-range
G. Kerker, Phys. Rev. B 23 (1981), 3082
P. Pulay, Chem. Phys. Lett. 73 (1980), 393
Achieving Self-Consistency
The Pulay Mixer
additional preconditioner might accelerate convergence
A
preconditioning matrix: G
R nopt
nin
1 nopt
G
in
in
k
2
k 2 k 20
long-range components of density changes are stronger damped than short-range
G. Kerker, Phys. Rev. B 23 (1981), 3082
two spin channels are to be mixed in the case of spin polarization
spin density: n r n r
charge density: n r n r
combine both channels to one matrix !
R n , n R n , n d r n r 2
stable convergence
P. Pulay, Chem. Phys. Lett. 73 (1980), 393
n rnout n in , r n in r
Achieving Self-Consistency
The Broyden Mixer
secant method
f x n f x n1 f ' x n x n x n 1
f x n 1
!
f x n 1 0
x n 1x n
f xn 1
f ' xn
f x n
xn
x n 1
xn
x n 1
x n 1
Achieving Self-Consistency
The Broyden Mixer
secant method
f x n f x n1 f ' x n x n x n 1
f x n 1
!
f x n 1 0
x n 1x n
f xn 1
f ' xn
f x n
x n 1
n in
1 nin
G Rn in
approximate Jacobian:
nin G Rn in 0
D.D. Johnson, Phys. Rev. B 38 (1988), 12807
Achieving Self-Consistency
The Broyden Mixer
secant method
f x n f x n1 f ' x n x n x n 1
f x n 1
!
f x n 1 0
x n 1x n
f xn 1
f ' xn
f x n
xn
x n 1
x n 1
under-determined
n in
1 nin
G Rn in
!G 1 G !0
G ij
nin G Rn in 0
approximate Jacobian:
G
1
G n
“as little change
as possible”
G R R D.D. Johnson, Phys. Rev. B 38 (1988), 12807
Achieving Self-Consistency
The Broyden Mixer
secant method
f x n f x n1 f ' x n x n x n 1
f x n 1
!
f x n 1 0
x n 1x n
f xn 1
f ' xn
f x n
xn
x n 1
x n 1
under-determined
n in
1 nin
G Rn in
approximate Jacobian:
!G 1 G !0
G ij
nin G Rn in 0
G
1
modified Broyden: minimize
G n
Ew0!G
1
“as little change
as possible”
G R R G
D.D. Johnson, Phys. Rev. B 38 (1988), 12807
! w ! n
2
i
i
i 1
G
R
!
i 2
Achieving Self-Consistency
Electronic Smearing
level crossing may lead to charge sloshing
i
i
i
N occ
n r l r EF
2
l
.......
2 1
Achieving Self-Consistency
Electronic Smearing
level crossing may lead to charge sloshing
i
i
i
N occ
n r l r EF
2
l
.......
2 1
electronic smearing softens the change of electronic density
i
i
i
n r f l 2l r
EF
l
1 f
l
1 f
l
1 f
l
Achieving Self-Consistency
Electronic Smearing
Fermi-Dirac1:
f
Gaussian2:
Methfessel-Paxton3:
f
f 0 x 1
2
E F
1
exp E " 1
F
E F 1
E F
1erf
2
1erf x N
x
f N x f 0 x Am H 2m 1 x e x
2
N #$
m1
1
N. Mermin, Phys. Rev. 137 (1965), A1441
2
C.-L. Fu, K.-H. Ho, Phys. Rev. B 28 (1983), 5480
3
M. Methfessel, A. Paxton, Phys. Rev. B 40 (1989), 3616
Achieving Self-Consistency
Electronic Smearing
Kohn-Sham functional not a variational quantity anymore
E& { c }
E& { c }, { f }
E&
fi
n0
'0
E F
% x Achieving Self-Consistency
Electronic Smearing
Kohn-Sham functional not a variational quantity anymore
E&
E& { c }, { f }
E& { c }
electronic free energy F is variational
fi
F
FE S ,{ f n }
fi
entropy term
'0
'0
n0
0
n0
Achieving Self-Consistency
Electronic Smearing
Kohn-Sham functional not a variational quantity anymore
electronic free energy F is variational
fi
F
FE S ,{ f n }
fi
entropy term
E&
E& { c }, { f }
E& { c }
n0
0
n0
systems with continuous density of states at the Fermi edge:
F E 0
(
O 2
O 2 N E 0
(
1
2
1
N 2
F E N 1 F E Fermi-Dirac / Gaussian
Methfessel-Paxton
desired total energy E for zero smearing can be backextrapolated
M. Gillan, J. Phys.: Condens. Matter 1 (1989), 689
M. Methfessel, A. Paxton, Phys. Rev. B 40 (1989), 3616
F. Wagner, T. Laloyaux, M. Scheffler, Phys. Rev. B 57 (1998), 2102
Achieving Self-Consistency
Alternative: Direct Minimization
EKS
g l
Etot
() *
l
KS
&
l ) l) l 1 E F
EE
constrained minimum of
Kohn-Sham functional:
l
E&
gradient:
f N l
l
KS
g l f l h l ) l
)l
) ) g 1
l
steepest-descent:
l
l
Spin Polarization
Fixed Spin vs. Unconstrained Spin
1
2
2 V eff r ) i i )i V XC r E XC
n r
E F
EF
EF
N f
i
i
i E F
w
N f
i
M N N total multiplicity kept fixed
i
i E F
w
N f i i
i E F
w
M f i f i
i
total spin is relaxed
Spin Polarization
Fixed Spin vs. Unconstrained Spin
Co3
fixed spin
PBE
obtained with
unconstrained spin
obtained multiplicity the lowest one
Energy Derivatives
Atomic Forces
total energy of the system is the total minimum of the Kohn-Sham-functional under
the normalization constraint:
(
*(
*
E tot min E i )i )i 1 E& c0 ( R * , ( R * , ( R *
(c*
KS
i
E&
(c* c c
0
0
E&
(* c c
0
0
Energy Derivatives
Atomic Forces
total energy of the system is the total minimum of the Kohn-Sham-functional under
the normalization constraint:
(
*(
*
E tot min E i )i )i 1 E& c0 ( R * , ( R * , ( R *
(c*
KS
i
E&
(c* c c
0
0
E&
(* c c
0
0
since the Kohn-Sham-functional is variational, only the partial derivative remains:
F =
=
d E tot
d R
E&
R
E&
R
(c0 *
E& (c 0 *
(c * R
+
0
E
( *
E& (*
(* R
+
=0
=0
KS
i )i ) i 1
R R i Energy Derivatives
The Individual Force Contributions
classical Coulomb interaction:
FHF , Z Z ,
,'
R R 3
l
,
l R r
R r
3
R
KS
h l l “moving basis functions”
Multipole-correction due to “incomplete” Hartree-potential:
FMP , d r n r n
Z d r n r Pulay-correction due to incomplete or nuclear-dependent basis set:
FPulay , 2 R R ,
MP
r V H n MP R
“moving multipole components”
gradient-dependency of exchange-correlation energy in case of a GGA functional:
XC n
2
FGGA , d r n r
n
2
R
Energy Derivatives
The Convergence of the Forces
total energy is variational
E&
error in the density enters total energy to second order
(c* c c
atomic forces are not variational
F
(c* c c
0
2 E&
0
0
error in the density enters total energy to first order
N-N (d=1.0 Å)
R (c* c c
'0
0
total energy
forces
convergence of atomic forces more expensive than total energy
Energy Derivatives
Forces and Electronic Smearing
Kohn-Sham functional not variational w.r.t. the occupation numbers
E& { c }, { }, {R }, { f } , E F E&
fi
'0
n0
atomic forces are not consistent with the total energy of the system !
F
=
d E tot
d R
E&
R
(f *
E& ( f * E& E F
(
f
*
E F R
R
+
'0
+
'
E&
R
=0
atomic forces are consistent with the electronic free energy
F
fi
0
n0
F
F
R
M. Weinert and J.W. Davenport, Phys. Rev. B 45 (1992), 13709
R.M. Wentzcovitch, J.L. Martin and P.B. Allen, Phys. Rev. B 45 (1992), 11372
Energy Derivatives
The Second Derivative and Vibrations
analytical
first derivative was simple
F E&
R
Energy Derivatives
The Second Derivative and Vibrations
analytical
first derivative was simple
F E&
R
second derivative more nasty
H ,
d 2 E tot
d R d R ,
d F
d R,
2 E&
R R,
(c*
2 E&
(c 0 *
R (c * R ,
e.g. A. Komornicki and G. Fitzgerald, J. Chem. Phys. 98 (2), 1398 (1993)
Energy Derivatives
The Second Derivative and Vibrations
analytical
first derivative was simple
F R
second derivative more nasty
H ,
E&
d 2 E tot
d R d R ,
d F
d R,
2 E&
R R,
(c*
2 E&
(c 0 *
R (c * R ,
set of coupled equations needs to be solved
2
2
E (c 0 *
E
2
R (c *
(c* (c* R e.g. A. Komornicki and G. Fitzgerald, J. Chem. Phys. 98 (2), 1398 (1993)
Energy Derivatives
The Second Derivative and Vibrations
numerical
d F
F R ,, 0 F R , , 0 d R,
2
R , ,0
vibrations
M R- d
d R
E (R *
u t u e
i.t
E (R* E (R 0 *
1
2
,
2
d E
d R d R , (R *
u u,
u R R , 0
0
!
det H , . 2 M 0
talk by Gert von Helden, Friday, 26th June, 11:30,
“Fingerprinting molecules: Vibrational Spectroscopy, Experiment and Theory”
Local Atomic Structure Optimization
Potential Energy Surface (PES)
E tot ( R *
Local Atomic Structure Optimization
Potential Energy Surface (PES)
E tot ( R *
Local Atomic Structure Optimization
Steepest Descent
( *
R , i1R ,i i F R , i
Local Atomic Structure Optimization
Steepest Descent
( *
R , i1R ,i i F R , i
too large too small (R *
Local Atomic Structure Optimization
Steepest Descent
( *
R , i1R ,i i F R , i
too large too small ill-conditioned PES might lead to zig-zag behaviour
(R *
Local Atomic Structure Optimization
Steepest Descent
( *
R , i1R ,i i F R , i
too large too small ill-conditioned PES might lead to zig-zag behaviour
(R *
Conjugate Gradient
take information of previous search directions into account
( *
R , i1R ,i i G ,i R , i
G ,iF ,i ,i G ,i 1
,iFletcher-Reeves
line minimization
constructions of search directions based upon the
assumption that PES is perfectly harmonic
,iPolak-Ribiere
F , i / F ,i
F , i1 / F ,i 1
F , i / F , iF ,i 1
F , i1 / F ,i 1
0
Local Atomic Structure Optimization
The Broyden-Fletcher-Goldfarb-Shanno Method
Newton-Method:
additional to the atomic forces, the Hessian is taken into account:
1
f x f x i xxi / f xi xxi / A/ xx i 2
f x f xi A/ xx i !
f x 0
1
x xi A / f x i (R *
W. H. Press et al., Numerical Recipes, 3rd Edition, Cambridge University Press
Local Atomic Structure Optimization
The Broyden-Fletcher-Goldfarb-Shanno Method
Newton-Method:
additional to the atomic forces, the Hessian is taken into account:
1
f x f x i xxi / f xi xxi / A/ xx i 2
f x f xi A/ xx i !
f x 0
1
x xi A / f x i (R *
“Quasi”-Newton-Scheme: inverse Hessian is approximated iteratively
( *
R , i1R ,i i G ,i R , i
R , i1R ,i H i 1 / F , iF ,i 1
H0 1
G ,iH i F , i
Hi 1 Hi 1 1 perfectly harmonic PES is assumed
line minimization
W. H. Press et al., Numerical Recipes, 3rd Edition, Cambridge University Press
Local Atomic Structure Optimization
Cartesian vs. Internal Coordinates
(R
d2
1
* (
, R 2 , R 3 # q1 , q 2 , q3
qB RR 0
2
d1
*
q 1d 1
q 2d 2
q 32
RR q difficult!
(3N-6) x (3N) 3 not invertable !
P. Pulay, G. Fogarasi, F. Pang, J.E. Boggs, J. Am. Chem. Soc. 101, 2550 (1979)
Local Atomic Structure Optimization
Cartesian vs. Internal Coordinates
(R
d2
d1
EE 0 )i qi i
*
q 1d 1
q 2d 2
1
1
F ij qi q j Fijk qi q j q k 2 ij
6 ijk
as “simple” as possible
q i
3
E
qi q j q k
q 32
RR q difficult!
(3N-6) x (3N) 3 not invertable !
E
F ijk
* (
, R 2 , R 3 # q1 , q 2 , q3
qB RR 0
2
)i 1
faster convergence of the
local geometry optimizer
P. Pulay, G. Fogarasi, F. Pang, J.E. Boggs, J. Am. Chem. Soc. 101, 2550 (1979)
Local Atomic Structure Optimization
Inverse-Distance Coordinates
appropriate for weekly bound systems
R
P.E. Maslen, J. Chem. Phys. 122, 014104 (2005)
J. Baker, P. Pulay, J. Chem. Phys. 105 (24), 11100 (1996)
Local Atomic Structure Optimization
Inverse-Distance Coordinates
appropriate for weekly bound systems
R
E
q
1
R
q
2 E
q
2
E
R
2
E
R
2
/R
2
/R 42
E 3
/R
R
P.E. Maslen, J. Chem. Phys. 122, 014104 (2005)
J. Baker, P. Pulay, J. Chem. Phys. 105 (24), 11100 (1996)
Local Atomic Structure Optimization
Inverse-Distance Coordinates
appropriate for weekly bound systems
R
E
q
1
R
q
2 E
q
2
E
R
2
E
R
2
/R
2
/R 42
( *
R , i1R ,i i G ,i R , i
E 3
/R
R
displacements are accelerated
for large interatomic distances
P.E. Maslen, J. Chem. Phys. 122, 014104 (2005)
J. Baker, P. Pulay, J. Chem. Phys. 105 (24), 11100 (1996)
Global Structure Optimization
Potential Energy Surface (PES)
E tot ( R *
Global Structure Optimization
Potential Energy Surface (PES)
E tot ( R *
Global Structure Optimization
Basin-Hopping
random variations of atomic coordinates followed by local structural relaxations
many different flavours of “trial moves” possible
D. J. Wales, J. P. K. Doye, M. A. Miller, P. N. Mortenson, and T. R. Walsh, Adv. Chem. Phys. 115, (2000)
Z. Li, and H. A. Scheraga, Proc. Natl. Acad. Sci. U.S.A. 84, 6611 (1987)
Global Structure Optimization
further methods...
Genetic Algorithms1:
two “parents” mate and create a “child”
the fittest (energetically lowest) children “survive”
talk by Matt Probert, Friday, 26th June, 9:00, “Structure predictions in materials science”
1
Minima-Hopping, Basin-Paving, Conformational Space Annealing,...
D. M. Deaven, K. M. Ho, Phys. Rev. Lett. 75, 288 (1995)
Summary
How to get Etot in DFT
density-mixing schemes (Pulay, Broyden)
direct minimization
Taking the derivative of Etot
atomic forces
molecular vibrations
What to do with Etot and its derivative
local structural relaxation (steepestdescent, conjugate gradient, BFGS)
global structure optimization (BasinHopping, Genetic Algorithms,...)
Summary
How to get Etot in DFT
density-mixing schemes (Pulay, Broyden)
direct minimization
Let's do it !!
Taking the derivative of Etot
atomic forces
molecular vibrations
What to do with Etot and its derivative
local structural relaxation (steepestdescent, conjugate gradient, BFGS)
global structure optimization (BasinHopping, Genetic Algorithms,...)
today, 14:00 – 18:00
first practical session
lecture hall