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

The Nuts and Bolts of First-Principles Simulation

  • Upload
    flo

  • View
    47

  • Download
    1

Embed Size (px)

DESCRIPTION

The Nuts and Bolts of First-Principles Simulation. Lecture 14: Forces and Stresses. Durham, 6th-13th December 2001. CASTEP Developers’ Group with support from the ESF  k Network. Overview of Lecture. Why bother? Theoretical background CASTEP details Symmetry and User Constraints - PowerPoint PPT Presentation

Citation preview

Page 1: The Nuts and Bolts of  First-Principles Simulation

The Nuts and Bolts of First-Principles Simulation

Durham, 6th-13th December 2001

Lecture 14: Forces and Stresses

CASTEP Developers’ Groupwith support from the ESF k Network

Page 2: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

2

Overview of Lecture

Why bother? Theoretical background CASTEP details Symmetry and User Constraints Conclusion

Page 3: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

3

Why bother? (I)

Structure optimisation Minimum energy corresponds to zero force Much more efficient than just using energy

alone Equilibrium bond lengths, angles, etc. Minimum enthalpy corresponds to zero force

and stress Can therefore minimise enthalpy w.r.t. supercell

shape due to internal stress and external pressure

Pressure-driven phase transitions

Page 4: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

4

Why bother? (II)

Molecular dynamics Can do classical dynamics of ions using forces

derived from ab initio electronic structure Copes with unusual geometry, bond-breaking,

chemical reactions, catalysis, diffusion, etc Incorporates effects of finite temperature of

ions Can generate thermodynamic information

from ensemble averaging Time dependent phenomena Temperature driven phase transitions

Page 5: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

5

Theoretical Background

Hellman-Feynman Theorem basic Quantum Mechanics

Density Functional Theory how it applies in DFT

Page 6: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

6

Hellman-Feynman Theorem (I) Classically we have the force F at

position R is determined from the potential energy as

Quantum mechanically we therefore expect

where

RF RU

ERF

H

E

Page 7: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

7

Hellman-Feynman Theorem (II) 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:

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

8

Stress and strain in action

a

b

c

aa+a

b

c

xx

xya

b

c

+

NB Much messier if non-orthogonal cell

Page 9: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

9

Hellman-Feynman Theorem (III)

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

10

Hellman-Feynman Theorem (IV)

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.

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

ii

ic

Page 11: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

11

Hellman-Feynman Theorem (V)

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.

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).

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

12

Hellman-Feynman Theorem (VI) 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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

13

Hellman-Feynman Theorem (VII)

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

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.

Similar expressions can also be derived for the stresses.

Page 14: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

14

Density Functional Theory (I) In DFT we have the Kohn-Sham Hamiltonian:

Therefore we only get contributions to the forces from the electron-ion (pseudo)potential and the ion-ion Coulomb interaction (the Ewald sum).

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

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

15

Density Functional Theory (II) As we do not have a complete basis, the

wavefunction will not be exact even within DFT.

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.

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

Page 16: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

16

Page 17: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

17

Density Functional Theory (III) However, if we use a non-variational

minimisation technique, such as density mixing, then such statements cannot be made.

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

This complicates the application of the Hellman-Feynman theorem.

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

Page 18: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

18

CASTEP details (I)

Forces and stresses are almost the highest level functionality

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.

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

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

19

CASTEP details (II)

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.

However, the modular design of new CASTEP completely hides this from the higher level programmer.

Page 20: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

20

CASTEP details (III)

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

correction to the forces derived from density mixing. However, the corresponding correction to the

stresses is not known. This has implications for structure optimisation

and molecular dynamics with density mixing Therefore the more recent Ensemble DFT

approach (which is fully variational) is to be preferred.

Page 21: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

21

Page 22: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

22

CASTEP details (IV) If the unit cell changes shape then the number of

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

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).

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

23

Page 24: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

24

Symmetry

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.

This ensures that the forces (stresses) have the same symmetry as the model.

Consequently, the symmetry of the system will be preserved in any structural relaxation or dynamics.

Page 25: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

25

User Constraints (I)

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

Currently, CASTEP can apply any arbitrary number of linear constraints on the atomic coordinates, up to the number of degrees of freedom. 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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

26

User Constraints (II) Both force and stress constraints work in the

same way – by Lagrange multipliers in the extended Lagrangian of the system:

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

27

User Constraints (III)

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

ama

Fma

m

a

m

Fa

qaqS

0

Page 28: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

28

User Constraints (IV)

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.

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

29

User Constraints (V)

Constraints can also be applied to the unit cell lengths and angles (giving 6 degrees of freedom).

Any length (angle) can be held constant, or tied to one or both of the others.

This is most useful if only a subset of the symmetries of the original unit cell is to be enforced.

Page 30: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

30

User Constraints (VI)

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.

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: The Nuts and Bolts of  First-Principles Simulation

Nuts and Bolts 2001

Lecture 14: Forces and Stresses

31

Conclusion

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

Can be combined with symmetry and/or constraints

Major use in structural relaxation and molecular dynamics