65
(Classical) Molecular Dynamics

(Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

(Classical) Molecular Dynamics

Page 2: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Basic MD– Chaos– Shadow trajectories– Ergodicity

• Practical MD

• Ensembles– MD generates the NVE ensemble– The canonical NVT ensemble: thermostats

• Integrating the equations of motion– Verlet or velocity Verlet?– Liouville formulation– Multiple time steps

• Applications: – Vibrations– Computing transport properties

Outline

Page 3: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Basic MD– Chaos– Shadow trajectories– Ergodicity

• Practical MD

• Ensembles– MD generates the NVE ensemble– The canonical NVT ensemble: thermostats

• Integrating the equations of motion– Verlet or velocity Verlet?– Liouville formulation– Multiple time steps

• Applications

Outline

Page 4: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Molecular dynamicsIs based on Newton's equations.

for i=1 .. N particles

The force F is given by the gradient of the potential

Given the potential, one can integrate the trajectory x(t) of the wholesystem as a function of time.

MD, the idea

Page 5: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

This is an N­body problem, which can only be solved numerically (except invery special cases)at least, in principle...

Naïve implementation: truncation of Taylor expansion

Wrong!The naive “forward Euler” algorithm• is not time reversible• does not conserve volume in phase space• suffers from energy driftBetter approach: “Verlet” algorithm

Numerical integration

Page 6: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Verlet algorithmcompute position in next and previous time steps

Or

Verlet algorithm:– is time reversible– does conserve volume in phase space, i.e., it is “symplectic” (conservation of “action element”             )– does not suffer from energy drift...but is it a good algorithm?i.e. does it predict the time evolution of the system correctly???

Verlet algorithm

Page 7: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Molecular chaos

Dynamics of “well­behaved” classical many­body system is chaotic.Consequence: Trajectories that differ very slightly in their initial conditions diverge exponentially (“Lyapunov instability”)

Chaos

Page 8: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Why should anyone believe Molecular Dynamics simulations ???

Chaos

Page 9: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Answers:

1.  Good  MD  algorithms  (e.g.  Verlet)  can  also  be  considered  as  good (NVE!)  Monte  Carlo  algorithm  –  they  therefore  yield  reliable  STATIC properties (“Hybrid Monte Carlo”)

2.  What  is  the  point  of  simulating  dynamics,  if  we  cannot  trust  the resulting time­evolution???

3. All is well (probably), because of... The Shadow Theorem.

Chaos

Why should anyone believe Molecular Dynamics simulations ???

Page 10: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Shadow theorem (hypothesis)•  For  any  realistic  many­body  system,  the  shadow  theorem  is  merely  a hypothesis.•  It basically  states  that good algorithms generate numerical  trajectories that are “close to” a REAL trajectory of the many­body system.•  Question:  Does  the  Verlet  algorithm  indeed  generate  “shadow” trajectories?• In practice, it follows an Hamiltonian, depending on the timestep, which is close to the real Hamiltonian    , in the sense that for                   converges to  

• Take a different look at the problem.– Do not discretize NEWTON's equation of motion…– ...but discretize the ACTION

Shadow trajectory

Page 11: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Lagrangian Classical mechanics

• Newton:

• Lagrange (variational formulation of classical mechanics):

– Consider a system that is at a point r0 at time 0 and at point rt attime t, then the system follows a trajectory r(t) such that:

is an extremum. 

Shadow trajectory

Page 12: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Lagrangian approach

Page 13: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Lagrangian

For example, if we use Cartesian coordinates:

Consider the “true” path R(t), with R(0)=r0 and R(t)=rt.Now, consider a path close to the true path:

Then the action S is an extremum if

what does this mean?

Shadow trajectory

Page 14: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Discretized action

For a one dimensional system this becomes

Shadow trajectory

Page 15: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Minimize the actionNow do the standard thing: Find the extremum for small variations in thepath, i.e. for small variations in all xi.

This will generate adiscretized trajectory thatstarts at time t0 at X0, andends at time t at Xt.

Shadow trajectory

Page 16: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Minimizing the action

Page 17: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• which is the Verlet algorithm!• The Verlet algorithm generates a trajectory that satisfies the boundaryconditions of a REAL trajectory –both at the beginning and at theendpoint.• Hence, if we are interested in statistical information about the dynamics(e.g. time­correlation functions, transport coefficients, power spectra...)...then a “good” MD algorithm (e.g. Verlet) is fine.

Minimizing the action

Page 18: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Yes, but: ergodicity

Molecular dynamics for sampling the phase space?

Page 19: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Molecular dynamics for sampling the phase space?

Yes, but: ergodicity

Page 20: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

1.Read essential parameters (temperature, # of atoms, time step, etc.)

2.Initialize system – positions and velocities

3.Evaluate forces

4.Integrate equations of motion

5.Stop after a given time – enough statistics for your measurement

Central loop

MD program

Page 21: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

MD program

Page 22: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Initialization

Page 23: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Evaluation of forces (in ab initio MD this is the expensive part)

Page 24: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Integrator (Verlet)

Page 25: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Basic MD– Chaos– Shadow trajectories– Ergodicity

• Practical MD

• Ensembles– MD generates the NVE ensemble– The canonical NVT ensemble: thermostats

• Integrating the equations of motion– Verlet or velocity Verlet?– Liouville formulation– Multiple time steps

• Applications

Outline

Page 26: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Initialization– Total momentum should be zero (no external forces)– Temperature rescaling to desired temperature– Particles/atoms/molecules start on a lattice or random positions

• Force calculations– Periodic boundary conditions– Straightforward force: Order N² algorithm:– neighbor lists, linked cell: Order N– Electrostatics: Ewald summation O(N1.5) 

• Integrating the equations of motion– Controlling the temperature by a Thermostat– Verlet or velocity Verlet?– Multiple time steps

To be taken care of, when doing MD in practice

Page 27: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Periodic Boundary Conditions

Clusters ARE different from bulk Surface! In a cube of length L, one particle per unit length : [L³­(L­2)³]/L³ ~ 6L²/L³

Page 28: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

MD in practice: tuning (some) parameters

Page 29: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

MD in practice: tuning (some) parameters

Page 30: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Basic MD– Chaos– Shadow trajectories– Ergodicity

• Practical MD

• Ensembles– MD generates the NVE ensemble– The canonical NVT ensemble: thermostats

• Integrating the equations of motion– Verlet or velocity Verlet?– Liouville formulation– Multiple time steps

• Applications

Outline

Page 31: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Lagrangian approach

Page 32: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

The Hamiltonian is defined as

Hamilton's equations are then

Integrating equations of motion (by Verlet) conserves the Hamiltonian

Hamiltonian approach

= U + K

Page 33: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

A solution to Hamilton’s equations conserves the TOTAL energy

MD samples the microcanonical ( NVE ) ensemble

Conservation of the Hamiltonian

E = U  + K

Page 34: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Sampling the canonical ensemble: thermostats

Page 35: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Thermostat: from NVE to NVT

Introduce thermostat in MD trajectory:

• deterministic thermostat– Nose­Hoover (1984)– Nose­Hoover chains (Martyna et al. 1992)

• stochastic thermostats– Andersen– Langevin– Nose­Hoover­Langevin (Leimkuhler et al, 2009)– Stochastic Velocity rescaling (Bussi­Donadio­Parrinello, 2007)

All of these alter the velocities such that the trajectory samples thecanonical NVT ensemble, and the partition function becomes

These thermostats differ in how they achieve this

Page 36: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Sampling the canonical ensemble: thermostats

Page 37: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Andersen thermostat

• Every particle has a fixed probability tocollide with the Andersen demon

• After collision the particle is give a newVelocity

• The probabilities to collide areuncorrelated (Poisson distribution)

• Downside: momentum not conserved.Fixed by Lowe­Andersen (2006)

Page 38: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Nosé thermostat

goal: compute MD trajectory sampling NVT ensemble.Take kinetic energy out of the system and store it into a reservoirThe reservoir can be seen as additional variable s that “stores” kinetic energyApproach: extended phase space  extended variable

effective massconstant to be set

Change of variable:

Original system Fictitious oscillator

Page 39: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Justification of Nosé thermostat

Hamiltonian of the atomic (sub)system

:

if:

Which is (proportional to) the canonical partition function for

Page 40: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Nosé thermostat: Effect of mass Q

Page 41: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Stochastic velocity rescaling thermostat

Page 42: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Stochastic velocity rescaling thermostat

Page 43: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Basic MD– Chaos– Shadow trajectories– Ergodicity

• Practical MD

• Ensembles– MD generates the NVE ensemble– The canonical NVT ensemble: thermostats

• Integrating the equations of motion– Verlet or velocity Verlet?– Liouville formulation– Multiple time steps

• Applications

Outline

Page 44: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Verlet vs Velocity Verlet

Verlet algorithm

Downside regular verlet algorithm: velocity is not known.

Velocity verlet (Andersen 1983):

Is based on Trotter decomposition of Liouville operator formulation,also basis of Multiple time steps, and modern thermostats such as theNose­Hoover­Langevin.

Page 45: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation

Definition of operator L

(implicit dependence on t)

A choice for a(x)

Formal solution (useless, unless...)

Page 46: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation

L1 and L2 do not commute:

Page 47: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation, Trotter decomposition

Trotter decomposition in general:

For iL = iL1 + iL2 :

Introducing the small, discrete time step Δt:

Since P = t/Δt, then the error at time t goes as  Δt².

While, per time step:

Page 48: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation: integrator for classical Hamiltonian

Let's start from a classical Hamiltonian

Evaluation of the exponential operator:

Page 49: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation: integrator for classical Hamiltonian

Stepwise application of the Liouville operator for a classical Hamiltonian

Page 50: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Velocity Verlet!

Liouville formulation: integrator for classical Hamiltonian

Gives directly the implementation:

Page 51: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation: multiple time­scale integrator

Hamiltonian with “fast” and “slow” degrees of freedom

Page 52: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Liouville formulation: multiple time­scale integrator

Introduction of a sub­timestep 

Page 53: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

• Basic MD– Chaos– Shadow trajectories– Ergodicity

• Practical MD

• Ensembles– MD generates the NVE ensemble– The canonical NVT ensemble: thermostats

• Integrating the equations of motion– Verlet or velocity Verlet?– Liouville formulation– Multiple time steps

• Applications: – Vibrations– Computing transport properties

Outline

Page 54: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Calculating vibrations via MD

Time autocorrelation functions can give information about vibrations– From Fermi's golden rule, the dipole time auto correlationfunction gives the intensities of IR active frequencies

– Velocity time autocorrelation gives all frequencies of vibration.

– Possible to assign to individual atoms displacements and project on eigenmodes.

Application: IR and power spectra

Electric dipole moment

Page 55: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Application: IR and power spectra

AuKr

LMG et al. NJP (2013)

Page 56: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Application: IR and power spectra

LMG et al. NJP (2013)

Page 57: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Au7, fluxionalityVibrational spectroscopy: Ac­Ala15­LysH+

Rossi et al., JCP Lett. (2010)

Page 58: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Rossi et al., JCP Lett. (2010)

Au7, fluxionalityVibrational spectroscopy: Ac­Ala15­LysH+

Page 59: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Rossi et al., JCP Lett. (2010)

Au7, fluxionalityVibrational spectroscopy: Ac­Ala15­LysH+

Page 60: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Au7, fluxionalityVibrational spectroscopy: water (Ice)

Bussi, Donadio, Parrinello JCP (2007)

Vibrational density of states of proton (H) in ice

Page 61: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Application: Transport coefficients (Diffusion)

Diffusion equation (Fick’s second law)

Solution for an initial c(x,0)=δ(0): all molecules at origin

Mean square displacement of the molecules

Time derivative gives

Page 62: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

General c(x,t)

Diffusion in 3 dimensions

Transport coefficients: Diffusion

Page 63: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Relation to velocity:

Transport coefficients: Diffusion

Page 64: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

Green –Kubo relationAlso exists for other transport coefficients, such as viscosity and conductivity

Define:

Transport coefficients: Diffusion

Page 65: (Classical) Molecular Dynamicsluca/Course_TU/03_Classical_MolecularDynamics.pdfMolecular dynamics Is based on Newton's equations. for i=1 .. N particles The force F is given by the

In general the microcanonical phase space density is

with 

Integration over momenta gives

N! comes from indistinguishability of particles.But MD conserves Hamiltonian H= E = constant (and constant total P).

with instantaneous temperature

MD generates the microcanonical ( NVE ) ensemble