lecture 14: forces and stresses - durham university

31
The Nuts and Bolts of First-Principles Simulation Durham, 6th-13th December 2001 Lecture 14: Forces and Stresses CASTEP Developers’ Group with support from the ESF ψ k Network

Upload: others

Post on 14-Feb-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 14: Forces and Stresses - Durham University

The Nuts and Bolts of

First-Principles Simulation

Durham, 6th-13th December 2001

Lecture 14: Forces and Stresses

CASTEP Developers’ Group

with support from the ESF ψk Network

Page 2: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 2

Overview of Lecture

r Why bother?

r Theoretical background

r CASTEP details

r Symmetry and User Constraints

r Conclusion

Page 3: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 3

Why bother? (I)

r Structure optimisation

l Minimum energy corresponds to zero force

l Much more efficient than just using energy alone

l Equilibrium bond lengths, angles, etc.

l Minimum enthalpy corresponds to zero force and stress

l Can therefore minimise enthalpy w.r.t. supercell shape due to internal stress and external pressure

l Pressure-driven phase transitions

Page 4: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 4

Why bother? (II)

r Molecular dynamicsl Can do classical dynamics of ions using forces derived from

ab initio electronic structure

l Copes with unusual geometry, bond-breaking, chemical reactions, catalysis, diffusion, etc

l Incorporates effects of finite temperature of ions

l Can generate thermodynamic information from ensemble averaging

l Time dependent phenomena

l Temperature driven phase transitions

Page 5: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 5

Theoretical Background

r Hellman-Feynman Theorem

l basic Quantum Mechanics

r Density Functional Theory

l how it applies in DFT

Page 6: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 6

Hellman-Feynman Theorem (I)

r Classically we have the force F at position R is

determined from the potential energy as

r Quantum mechanically we therefore expect

where

( )RF RU−∇=

ERF −∇=

ΨΨΨΨ

=H

E

Page 7: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 7

Hellman-Feynman Theorem (II)

r If we write the three unit cell vectors a, b, c as the columns of a

matrix h then the effect of an applied strain is to change the shape of the unit cell:

r We then have the stress tensor σσ related to the strain tensor εε by:

where is the volume of the unit cell.αβ

αβ εσ

∂∂

Ω=

E1

( )håIh +=′

( )cba ו=Ù

Page 8: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 8

Stress and strain in action

a

b

c

α

βγada+δa

b

c

α

βγσσxx

σσxy

a

b

c

αβ

γ dγ+δγ

NB Much messier if non-orthogonal cell

Page 9: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 9

Hellman-Feynman Theorem (III)

r The Hellman-Feynman Theorem states that for any perturbation λ we have

which obviously includes the case we are interested in. We have assumed that the wavefunction is properly normalised and is an exact eigenstate of H.

Ψ∂∂

Ψ=Ψ∂∂

Ψ+ΨΨ∂∂

=

Ψ∂∂

Ψ+

∂Ψ∂

Ψ+Ψ∂Ψ∂

=

∂Ψ∂

Ψ+Ψ∂∂

Ψ+Ψ∂Ψ∂

=∂

λλλ

λλλ

λλλλ

HHE

HE

HH

HE

Page 10: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 10

Hellman-Feynman Theorem (IV)

r To evaluate <E> for an unknown wavefunction Ψ we first expand it in terms of a complete set of fixed basis functions ϕ

and then use the Variational Principle to find the set of complex coefficients ci that minimise the energy.

r If the basis set is incomplete then we arrive at an upper-bound for the energy.

ii

ic ϕ∑=Ψ

Page 11: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 11

Hellman-Feynman Theorem (V)

r If we have an approximate eigenstate Ψ, for example from using an incomplete basis set, then we must keep all 3 terms in the general expression.

r If our basis set depends upon the ionic positions, such as atomic centred Gaussians, then the other derivatives in the general expression will contribute so-called Pulay forces (stresses).

r Note that Pulay forces (stresses) will vanish in the limit of a complete basis set, but that this is never realized in practice, or if position independent basis functions, such as plane-waves, are used.

Page 12: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 12

Hellman-Feynman Theorem (VI)

r If we choose plane-waves as our basis functions, then

because these functions are independent of the ionic coordinates, it can easily seen that the general

expression for the forces becomes:

( ) ( )

( ) ( )∑

∑∑

∂∂

=

∂∂

=∂

jijiji

jjji

ii

rR

Hrcc

rcHrcRR

E

,

**

**

ϕϕ

ϕϕ

Page 13: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 13

Hellman-Feynman Theorem (VII)

r That is, we can calculate the forces using the same expansion coefficients as we used to variationallyminimise the energy, using matrix elements of the ionic derivative of the Hamiltonian.

r This makes calculation of the forces relatively cheap once the variational energy minimisation has been completed if we are using a plane-wave basis set.

r Similar expressions can also be derived for the stresses.

Page 14: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 14

Density Functional Theory (I)

r In DFT we have the Kohn-Sham Hamiltonian:

r Therefore we only get contributions to the forces from the

electron-ion (pseudo)potential and the ion-ion Coulomb interaction (the Ewald sum).

r Also contribution from exchange-correlation potential if using non-linear core corrections.

r However, for the stresses, we also get a contribution from the

kinetic energy and Hartree terms.

( ) ( ) ( ) ( ) ( )RrRrrRr r ionionXCeionee VVVVH −−− ++++∇−= ,2

1,ˆ 2

Page 15: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 15

Density Functional Theory (II)

r As we do not have a complete basis, the wavefunction will not be exact even within DFT.

r If we use a variational method to minimize the total energy, then we know that the energy and hence the wavefunction will be correct to second order errors.

r However, the forces will only be correct to first order e need a larger basis set for accurate forces than for energies.

Page 16: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 16

Page 17: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 17

Density Functional Theory (III)

r However, if we use a non-variational minimisation technique, such as density mixing, then such statements cannot be made.

r We can no longer guarantee that the energy found is an upper-bound on the true ground state energy.

r This complicates the application of the Hellman-Feynman theorem.

r Consequently, non-variational forces and stresses are less reliable.

Page 18: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 18

CASTEP details (I)

r Forces and stresses are almost the highest level functionality

r Single subroutine call to first derivatives module is all that is required to return the forces for the current model if ground state is already known. Ditto stress.

r firstd puts together the different contributions to the force (stress) using other functional modules so the physics is obvious.

r These in turn call down to operations on charge densities and potentials. Even at this level the physics is obvious and the details of USPs etc are hidden.

Page 19: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 19

CASTEP details (II)

r The use of Ultra-Soft Pseudopotentials further

complicates things, as there are now additional contributions to both the forces and the stresses from

the charge augmentation.

r However, the modular design of new CASTEP

completely hides this from the higher level

programmer.

Page 20: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 20

CASTEP details (III)

r There is a problem with the application of the Hellman-Feynman theorem with non-variational minimisersl Consequently the CASTEP code contains a first-order correction to the

forces derived from density mixing.

l However, the corresponding correction to the stresses is not known.

r This has implications for structure optimisation and molecular dynamics with density mixing

r Therefore the more recent Ensemble DFT approach (which is fully variational) is to be preferred.

Page 21: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 21

Page 22: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 22

CASTEP details (IV)r If the unit cell changes shape then the number of plane-waves

and the FFT grid will, at some point, change discontinuously.

r Consequently, it becomes difficult to compare results at different cell sizes at the same nominal basis set size (cut-off energy) as the effective quality of the basis set is not the same, unless the basis set is fully converged (impossible).

r This can be countered by using the Finite Basis Set Correction, which calculates the change in total energy upon changing the basis set size at a fixed cell size, and then uses this to correct the total energy and stress at nearby cell sizes.

Page 23: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 23

Page 24: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 24

Symmetry

r If the symmetry of the system has been calculated

(controlled by keyword in input file) then this can be used to symmetrise the forces and stresses.

r This ensures that the forces (stresses) have the same

symmetry as the model.

r Consequently, the symmetry of the system will be

preserved in any structural relaxation or dynamics.

Page 25: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 25

User Constraints (I)

r Sometimes it is desired to impose additional constraints on any structural relaxation or dynamics.

r Currently, CASTEP can apply any arbitrary number of linear constraints on the atomic coordinates, up to the number of degrees of freedom. l E.g. fixing an atom, constraining an atom to move in a line or

plane, fixing the relative positions of pairs of atoms, fixing the centre of mass of the system, etc.

Page 26: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 26

User Constraints (II)r Both force and stress constraints work in the same way – by

Lagrange multipliers in the extended Lagrangian of the system:

r So for a given set of constraints S(q) we need to know the derivatives of the constraints and then if we can determine λ we have the constraint force.

( ) ( ) ( )

q

SFqm

q

S

q

L

q

L

dt

d

qSqqLqqL

iii

cons

cons

∂∂

−=

∂∂

−∂∂

=

−=

λ

λ

λ

&&

&

&&

0

0 ,,

Page 27: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 27

User Constraints (III)

r Linear constraints for the ionic motion makes the matrix

of constraint derivatives trivial and therefore

determining λ:

( )

∑∑

=

=

=

ii

i

i

ii

i

i

i i

i

i

ii

iii

am

aF

m

a

m

a

m

Fa

qaqS

λ

λ0

Page 28: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 28

User Constraints (IV)

r If we have multiple constraints, S(q), R(q), etc. then we may satisfy each constraint simultaneously if the constraint matrices are all mutually orthogonal and so we use Gram-Schmidt on the coefficients.

r With non-linear constraints, both the constraints and their derivatives need to be specified, and it is not possible in general to satisfy them all simultaneously. Consequently, iterative procedures such as SHAKE or RATTLE are required.

Page 29: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 29

User Constraints (V)

r Constraints can also be applied to the unit cell lengths

and angles (giving 6 degrees of freedom).

r Any length (angle) can be held constant, or tied to one

or both of the others.

r This is most useful if only a subset of the symmetries of

the original unit cell is to be enforced.

Page 30: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 30

User Constraints (VI)

r Cell constraints are implemented in a slightly different way. The stress tensor is transformed from its normal symmetric representation in Cartesian coordinates into the space of cell lengths and angles.

r There is then a 1:1 correspondence between the stress components and the cell degrees of freedom and so the constraints may be trivially applied to the stress and hence to the evolution of the system.

Page 31: Lecture 14: Forces and Stresses - Durham University

Nuts and Bolts 2001 Lecture 14: Forces and Stresses 31

Conclusion

r Hellman-Feynman Theorem gives us a simple recipe for calculating ab initio forces and stressesl plane-wave basis has big advantage

l DFT implementation

r Can be combined with symmetry and/or constraints

r Major use in structural relaxation and molecular dynamics