Ab initio molecular dynamics Simone Piccinin

39
Simone Piccinin CNR-IOM DEMOCRITOS Trieste, Italy Bangalore, 04 September 2014 Ab initio molecular dynamics

Transcript of Ab initio molecular dynamics Simone Piccinin

Page 1: Ab initio molecular dynamics Simone Piccinin

Simone Piccinin CNR-IOM

DEMOCRITOS Trieste, Italy

Bangalore, 04 September 2014

Ab initio molecular dynamics

Page 2: Ab initio molecular dynamics Simone Piccinin

What is MD? 1) Liquid 2) Liquids 3) Solvated protein

4) Dye/TiO2/electrolyte 5) Solid to liquid

Page 3: Ab initio molecular dynamics Simone Piccinin

We call molecular dynamics (MD) a computer simulation technique where the time evolution of a set of interacting particles is followed by integrating their equations of motion.

•  In MD particles obey classical mechanics (Newton’s law):

~Fi = mi~ai

•  In contrast with the Monte Carlo methods, MD is a deterministic method: given an initial set of positions and velocities, the time evolution of the system of interacting particles is in principle completely determined.

•  Through a MD simulations we can compute equilibrium and transport properties of a system.

What is MD?

Page 4: Ab initio molecular dynamics Simone Piccinin

The result of a MD simulation is a trajectory in a 6N-dimensional phase space.

Often we are not particularly interested in the trajectory itself, but in using this trajectory as a way to sample some statistical distribution function (statistical ensemble), like in Monte Carlo simulations.

The probability density function ρ in the various ensembles is given by:

Microcanonical Ensemble (NVE):

Canonical Ensemble (NVT):

Isothermal-Isobaric Ensemble (NPT):

Grand Canonical Ensemble (µVT):

⇢(�) / e�H(�)KBT

⇢(�) / e�H(�)�µKBT

⇢(�) / �(H(�)� E)

⇢(�) / e�H(�)+pV

kBT

What is MD?

Page 5: Ab initio molecular dynamics Simone Piccinin

In statistical physics, physical quantities are given by averages over configurations distributed according to specific statistical ensembles (ensemble averages).

Under the ergodic hypothesis, a sufficiently long MD trajectory provides such a set for the ensemble in which it was run.

Ensemble averages can hence be evaluated as time averages over an MD trajectory:

Ensemble average:

Time average:

Ergodicity:

hAi =Z

A(�)⇢(�)d�

AT =1

M

MX

n=1

A(tn)

limt!1

AT ! hAi

What is MD?

Page 6: Ab initio molecular dynamics Simone Piccinin

Force Fields

Forces Fi are given in (classical) MD by empirical force fields.

Examples:

2-body potentials, Lennard-Jones

Page 7: Ab initio molecular dynamics Simone Piccinin

Force Fields

Forces Fi are given in (classical) MD by empirical force fields.

Examples:

3-body potentials, Stillinger-Weber

Page 8: Ab initio molecular dynamics Simone Piccinin

Force Fields

Forces Fi are given in (classical) MD by empirical force fields.

Examples:

Force fields for proteins (Amber, Charmm, …)

(Image: Adv Drug Del Rev)

Page 9: Ab initio molecular dynamics Simone Piccinin

Integration of the E.O.M. Taylor expansion of r(t):

Summing these 2 eqns:

Page 10: Ab initio molecular dynamics Simone Piccinin

Integration of the E.O.M.

Good things about the Verlet algorithm:

•  Time reversibility

•  Symplectic algorithm

Liouville’s theorem (Hamiltonian dynamics): dA=dA’ Stability of the algorithm

Page 11: Ab initio molecular dynamics Simone Piccinin

MD run

1)  Initialization: Assign positions and velocities to particles, usually followed by structural optimization

2)  Equilibration: Physical quantities need to become stationary before we start taking averages

3)  Measurement: Simulate a sufficiently long trajectory and perform time averages of the quantities of interest

Instantaneous temperature:

In NVT and NPT ensembles we want to impose a certain temperature Tw

hEkini =1

2

3NX

i=1

miv2i =

1

2(3N)kBT

Page 12: Ab initio molecular dynamics Simone Piccinin

•  Velocity rescaling

•  Berendsen (1984)

τ ∞ : microcanonical ensemble

τ=δt: velocity rescaling

• Andersen (1980) Select one particle at random every τ and reassign its velocity drawing from the Maxwell-Botzmann distribution. Correct NVT sampling for τ ∞

No constant of motion. Discontinuous trajectories.

Thermostats

� =pTW /T (t)

dT (t)

dt=

1

⌧(T0 � T (t)) �2 = q +

�t

✓T0

T (t)� 1

Page 13: Ab initio molecular dynamics Simone Piccinin

•  Nose’-Hoover

S. Nosé, J. Chem. Phys. 81, 511 (1984).

W. G. Hoover, Phys. Rev. A 31, 1695 (1985).

•  Canonical sampling through velocity rescaling (CSVR)

Bussi et al. J. Chem. Phys. 126, 014101 (2007)

Both have a constant of motion and sample the NVT ensemble

Barostats (NPT)

•  Parrinello-Rahman barostat

Parrinello and Rahman, J. Appl. Phys. 52 (1981) 7182

Thermostats

Page 14: Ab initio molecular dynamics Simone Piccinin

•  Free of parameterization and only fundamental constants required.

•  Bond forming and breaking processes can, in principle, be treated accurately.

•  Transferable, unlike many classical MD methods.

Why ab initio MD?

Page 15: Ab initio molecular dynamics Simone Piccinin

r electrons, R ions

electron-electron repulsion

ion-ion repulsion

electron-ion attraction

Total wavefunction (both electrons and nuclei treated as QM particles)

Full quantum dynamics is extremely complicated and not needed in most cases.

Quantum Dynamics

Page 16: Ab initio molecular dynamics Simone Piccinin

First solve for clamped nuclei

Instantaneous representation for full solution

Integrate out r dependence

Decoupling electrons and ions

Page 17: Ab initio molecular dynamics Simone Piccinin

Non-adiabatic coupling terms:

Decoupling electrons and ions

l  

leads to the “Born-Oppenheimer” approximation

Page 18: Ab initio molecular dynamics Simone Piccinin

Born-Oppenheimer Dynamics

Kinetic energy Effective potential energy

In the BO approximation, the dynamics of ions does not change the state of the electronic sub-system. Thus,

The dependence of the electronic wave-function on the nuclear positions is now suppressed.

Ek(R) defines an energy eigenvalue for every configuration R - Potential Energy Surface (of the kth electronic eigenstate) Classical ions would move on the ground-state (k=0) surface.

Page 19: Ab initio molecular dynamics Simone Piccinin

Let’s define a classical Lagrangean for B-O dynamics

Equations of motion are obtained by

Thus we have

The potential energy at every instant is obtained by solving the electronic problem variationally.

Classical dynamics for ions

Page 20: Ab initio molecular dynamics Simone Piccinin

where the first term is just the DFT energy computed from the ground-state density n(r) by methods discussed earlier in this school.

Hellmann-Feynman forces :

External potential on electrons

DFT Energy and forces

Page 21: Ab initio molecular dynamics Simone Piccinin

Thermodynamic averages

Page 22: Ab initio molecular dynamics Simone Piccinin

•  At every time step we need to perform a minimization to reach self consistency. This could be time-consuming (especially around 1985 where iterative diagonalization schemes were not employed in first-principles calculations).

•  The accuracy of the simulation critically depends on the accuracy of the SCF minimization (Energy drifts).

•  The performance depends on the algorithms used to extrapolate the wavefunctions from the previous steps.

BO molecular dynamics

Page 23: Ab initio molecular dynamics Simone Piccinin

BO-MD: energy conservation

Herbert and Head-Gordon, PCCP 7, 3269 (2005)

•  The SCF threshold strongly influences the energy conservation (drift)

•  The extrapolation algorithm strongly influences the number of iterations required to reach the desired SCF convergence

Page 24: Ab initio molecular dynamics Simone Piccinin

BO-MD: energy conservation

Herbert and Head-Gordon, PCCP 7, 3269 (2005)

•  Similarly, the error on the forces critically depends on the accuracy of the SCF calculation

Page 25: Ab initio molecular dynamics Simone Piccinin

Choosing parameters for MD • A larger time step means smaller overall computational cost.

The maximum time step is set by the fastest ionic motion:

dt ~ 0.01 - 0.1dtmax where dtmax=1/ωmax=period of fastest phonon.

• The criterion for SCF convergence at each step should be very strict to conserve energy, avoid systematic drifts and ensure accurate forces.

Page 26: Ab initio molecular dynamics Simone Piccinin

•  Historically, this is the first first-principles MD reported.

•  Today (July 2014) total no. of citations exceeds 6500 !

Trieste, June 2007

Page 27: Ab initio molecular dynamics Simone Piccinin

The CP Method •  The dynamics of electrons and nuclei happen of very different time scales: electrons move very fast compared to the slow nuclei.

•  Car & Parrinello: exploit this adiabatic time scale separation

•  Idea : introduce a fictitious dynamics for the electrons which keeps the electrons close to the ground state, by treating the orbital degrees of freedom as classical variables.

Page 28: Ab initio molecular dynamics Simone Piccinin

The CP Method

Euler-Lagrange equations :

Equations of motion :

CP Lagrangean :

Page 29: Ab initio molecular dynamics Simone Piccinin

• Electronic degrees of freedom are the expansion coefficients of KS orbitals into PW.

• “Forces” on electrons are determined by the KS Hamiltonian calculated from current values of ϕk and RI.

• “Forces” acting on nuclei have the Hellman-Feynman form :

but they slightly differ from “true” (i.e. BO) forces.

• The dynamics of the orbitals is fictitious, i.e. not real dynamics of electrons.

The CP Method

Page 30: Ab initio molecular dynamics Simone Piccinin

•  Ions evolve in time at a certain (instantaneous) physical temperature

• Electrons evolve in time at a certain (instantaneous) fictitious temperature

• We have to ensure that during the dynamics the electrons stay “cold” while following adiabatically the motion of the nuclei.

• This is possible if the two sub-systems (electrons and nuclei) are decoupled, i.e. if their power spectra do not overlap.

• This therefore amounts to impose and preserve a metastability condition for a sufficiently long time, since equipartition would ensure that each degree of freedom acquires ½ kBT.

• The fictitious kinetic energy is a measure of the departure from the BO surface.

The CP Method

Page 31: Ab initio molecular dynamics Simone Piccinin

Econs (constant of motion): accuracy of the integration of the e.o.m. Ephys and Te: degree of adiabatic separation.

The CP Method

Page 32: Ab initio molecular dynamics Simone Piccinin

Adiabatic separation in CP ���(i.e. why does it work?)

Power spectrum of the dynamics of the electronic degrees of freedom for a 8-Si atom system sampled at the Γ point.

Power spectrum obtained from the Fourier transform of the velocity-velocity correlation function:

Page 33: Ab initio molecular dynamics Simone Piccinin

Adiabatic separation in CP

•  Frequency spectrum of the orbital degrees of freedom

•  Lowest electronic frequency:

•  To ensure adiabatic separation

=> reduce the fictitious mass as much as possible

•  Highest electronic frequency:

•  Maximum time step to integrate the fastest frequency.

Page 34: Ab initio molecular dynamics Simone Piccinin

Adiabatic separation in CP

The fictitious mass µ and time step δt must be chosen in such a way that:

•  µ is big enough to enable the use of a reasonable time step, and small enough to guarantee:

o  adiabaticity, i.e. no energy transfer from nuclei to electrons, which always remain close to the ground state (BO surface)

o  correctness of the nuclear trajectory (small error in forces)

Typical values: ~100-400 electron masses

•  δt should be the largest value that yields a stable dynamics (no drifts, no loss of orthonormality)

Page 35: Ab initio molecular dynamics Simone Piccinin

Errors on forces

•  The error of the CP forces compared to the BO ones show two distinct time scales:

•  High-frequency small-amplitude oscillations.

•  Low-frequency ( = nuclear) “large amplitude” fluctuations, due to the drag of the nuclei exerted on the electrons, due to the fact that they have a finite mass µ.

•  Note the the finite mass of the electrons dampens artificially the nuclear motion. This effect can be controlled by reducing the fictitious mass.

Page 36: Ab initio molecular dynamics Simone Piccinin

Energy drift : CP vs BO The use of the Verlet algorithm for propagating the e.o.m. ensures reversibility, which can be shown to lead to no energy drift. BO dynamics, on the other hand, can suffer from systematic energy drifts, which however can be controlled by the degree of convergence of the SCF procedure.

Page 37: Ab initio molecular dynamics Simone Piccinin

Metals with CP?

If the gap reduces to zero the approach breaks down, since it is not possible to decouple the electronic and ionic energy scales.

Possible remedies:

•  Thermostat the electrons to prevent them from heating up Pasquarello et al. PRL 69, 1982 (1992).

•  Ensemble DFT: the function to minimize is a “free energy” Marzari et al. PRL 82, 3296 (1999).

•  This can be cast in an extended Lagrangian formalism: Stengel et al. PRB 62 15283 (2000).

•  Use BO molecular dynamics.

Page 38: Ab initio molecular dynamics Simone Piccinin

CP in Quantum-ESPRESSO

•  CP molecular dynamics can be performed with the cp.x code.

•  Norm-conserving as well as ultrasoft pseudopotentials can be used.

•  Gamma-point only (wave functions are real).

•  NVT (Nose-Hoover chains) as well as NPT (Parrinello-Rahman) ensembles.

•  Simulations in finite electric fields.

•  The code is interfaced with the PLUMED plug-in to perform free energy calculations (metadynamics, umbrella sampling, ...)

Page 39: Ab initio molecular dynamics Simone Piccinin

References •  Most of the equations have been taken from D. Marx and J. Hutter, “Ab initio molecular dynamics”, Cambridge University Press, 2009

•  Part of the material has been adapted from P. Giannozzi’s tutorial on QE http://www.fisica.uniud.it/~giannozz/QE-Tutorial/

•  The original CP paper is R. Car and M. Parrinello, Phys. Rev. Lett. 55, 2471 (1985).