You are on page 1of 46

CML801: Molecular Modelling and Simulations: Concepts

and Techniques

Dr. Hemant Kumar Kashyap


Department of Chemistry
Indian Institute of Technology Delhi, India

Department
Department of Chemistry
of Chemistry
Indian Institute of Technology Delhi, India
Indian Institute of Technology Delhi, India
Atomistic MD (Classical)
• Uses Born-Oppenheimer Approximation
• Atoms are assumed in their ground electronic states

Born-Oppenheimer Approximation
Total wavefunction, (R i , r ) = (R i ) (r , R i ) as me
M →0
 (R i ) : Nuclei wavefunction
 (r , R i ) : Electron wavefunction parametrically depending on R i

𝐻𝑇𝑜𝑡𝑎𝑙 = 𝐻𝑒𝑙𝑒𝑐𝑡𝑟𝑜𝑛𝑖𝑐 + 𝐻𝑁𝑢𝑐𝑙𝑒𝑎𝑟

𝐻𝑒 : Governs electronic motion (HF, DFT etc.)


𝑃𝐼2
𝐻𝑁 = σ𝐼 + U(RI): Governs nuclear motion or overall motion of the
2𝑀𝐼
atom (Newton's Law or Hamilton’s equations of motion; Molecular
Dynamics(MD)
HISTORY

The second MD of argon liquid was done by Aneesur


Rahman in 1964, assuming argon atoms interaction via
Lennard-Jones interaction.
A. Rahman, “Correlations in the Motion of Atoms in Liquid Argon”,
Phys. Rev. 136 (1964), A405

First MD on liquid water came from Rahman and Stillinger.


A. Rahman and F.H. Stillinger “Molecular Dynamics Study of Liquid
Water” J. Chem. Phys. 55 (1971)
J. Chem. Phys., 151, 244705 (2019) J. Mol. Liq., 291, 111269 (2019) J. Phys. Chem. B, 123, 6543 (2019)
Side View

Top View

J. Phys. Chem. B, 123, 9616 (2019) J. Chem. Phys., 151, 215103 (2019)
Science, 321, 5890, 798-800 (2008)
AA/CG MOLECULAR DYNAMICS SIMULATIONS
o Define Force-field (Intra- and Inter-molecular terms) for your
system
o Choose the Ensemble (NVE, NVT, NPT, …) to define the
thermodynamic or macro-state of the system
o Integrate Newton’s Equation of motion for each particle
(Leap-Frog, Velocity-Verlet etc); Advance micro-states
o Analyze the Equilibrium Trajectory [ri(t),vi(t), i=1,N]
o Structural Properties: Radial distribution function (g(r)),
Structure Function (S(q))…
o Dynamic Properties: Mean Square Displacement (<r2(t)>),
VACF, Diffusion Coefficients, Conductivity, Viscosity

7
Basic MD Algorithm

Set initial conditions ri (t0 ) and v i (t0 )

Get the forces Fi (ri ) Most Important Part of MD

Solve the equations of motion


numerically over a short step dt
ri (t ) → ri (t + dt)
t) Advancing the positions and
v i (t ) → v i (t + dt)
t) velocities of each atom

t =t+
dtt

Is t  t max? Condition to stop the MD run,


i.e. at simulation time

Compute the results and finish


jth

ith

Finite difference method


Integration of Equation of Motion (Taylor Expansion) :
1
𝑟𝑖 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 3 )
2
𝑣𝑖 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 + 𝑂(𝑑𝑡 2 )
Intermolecular Interactions and Potential Energy Surfaces
MD simulations consists of the numerical, step-by-step, solution of classical
Newton’s equations of motion which mainly involves calculation of forces on each
atom or particle  
mi ai = Fi jth
 N 
Fi =  f ij 𝑓𝑖𝑗 = −𝛻𝑖 𝑈(𝑟𝑖𝑗) ith
j i

Example: Simulation of Argon (Monatomic System)


Pair Potential : Lennard-Jones
  12   6    
12
 
6

V (r ) = 4   −   
     
f ij = − iV (rij ) = 24 2 2  −   rij
 r   r   rij   rij  r
 ij

 
 

  12   6 
V (r ) = 4   −   
 r   r  
rcut V(r)

 rcut r
Intermolecular Interactions and Potential Energy Surfaces
Stretching Energy

Bending Energy
Torsion Energy
Non-Bonded Energy
Polyatomic Molecular System

V ϕ,𝑚
෍ 𝑘𝑖𝑗𝑘𝑙 (1 + cos(ϕ𝑖𝑗𝑘𝑙 − 𝛾𝑚 )
𝑚

Examples: Simulation of
water, ionic liquids, protein,
DNA, lipid membrane etc
CHARMM Force-field

V =

OPLS Force-field
1 𝑟 2 1 𝜃 2
V= σ𝑏𝑜𝑛𝑑𝑠 𝑘𝑖𝑗 𝑟𝑖𝑗 − 𝑟𝑒𝑞 + σ𝑎𝑛𝑔𝑙𝑒𝑠 𝑘𝑖𝑗𝑘 𝜃𝑖𝑗𝑘 − 𝜃𝑒𝑞 +
2 2

1 𝜎 12 𝜎 6 𝑞𝑖 𝑞𝑗
ϕ,𝑚
෍𝑡𝑜𝑟𝑠𝑖𝑜𝑛 ෍ 𝑘𝑖𝑗𝑘𝑙 (1 + cos(ϕ𝑖𝑗𝑘𝑙 − 𝛾𝑚 ) + 4𝜀 − +
2 𝑎𝑛𝑔𝑙𝑒𝑠 𝑚 𝑟 𝑟 4𝜋𝜀0 𝑟

17
Mostly used MD Engines and Force-field for Liquids, Materials and
Biological Systems

▪ CHARMM (Chemistry at HARvard Molecular Mechanics)


▪ AMBER (Assisted Model Building with Energy Refinement)
▪ NAMD (NAnoscale Molecular Dynamics)
▪ GROMACS (GROningen MAchine for Chemical Simulations)
▪ LAMMPS (LArge-scale Molecular Massively Parallel Simulator)

Mostly used force field:

▪ CHARMM (Chemistry at HARvard Molecular Mechanics)


▪ AMBER (Assisted Model Building with Energy Refinement)
▪ OPLS-AA (All atom Optimized Potential for Liquid Simulations)

18
Periodic Boundary Conditions (PBC)

• Typically, 10<N<109 , small compared to NA=6.022 x 1023


• For N=1000 particles arranged in 10x10x10 cube, the number of particles at
the surface (cube faces) 𝑵𝑺𝒖𝒓𝒇𝒂𝒄𝒆 ≈ 𝟒𝟖𝟖

• Particle on the surface will experience quite different forces than those in the bulk
or middle of the box

• PBC is must for simulation of bulk properties of solid/liquid/gas

• PBC not needed for small liquid droplet, microcrystals or surface


properties
Periodic Boundary Conditions (PBC)
• Replication of central box around itself
• Consequently, as the simulation proceeds, the particles move in the
infinite periodic system

central box

As if we are having boxes


without boundary
Periodic Boundary Conditions (PBC)
Implementation of PBC
(-L/2,L/2) (-L/2,L/2)
Coordinates with PBC
x`i(t+dt),y`i(t+dt) (Wrapped coordinate)

(0,0)

xi(t),yi(t) xi(t+dt),yi(t+dt)
Coordinates without PBC
(-L/2,-L/2) (L/2,-L/2) (Unwrapped coordinate)

IF (xi(t+dt) > L/2) THEN x`i(t+dt)= xi(t+dt)-L


IF (xi(t+dt) < -L/2) THEN x`i(t+dt)= xi(t+dt)+L
IF (yi(t+dt) > L/2) THEN y`i(t+dt)= yi(t+dt)-L
IF (yi(t+dt) < -L/2) THEN y`i(t+dt)= yi(t+dt)+L

OR
x`i(t+dt) = xi(t+dt) –nint(xi(t+dt)/L)
y`i(t+dt) = yi(t+dt) –nint(yi(t+dt)/L)
nint(a)=nearest integer to a
Minimum Image Convention (MIC) and its Implementation

L Use rij’ not rij

rcut
xij’ = xij - L* nint(xij/L)
j’ i
j yij’= yij – L* nint(yij/L)

nint(a)=nearest integer to a
rcut < L/2

• Smallest distance between the ith particle and jth particle or its any image should
be considered for the calculation of force
MD in NVE Ensemble

System
NVE

Finite difference method to Integrate equations of motion


Integration of Equation of Motion (Taylor Expansion) :

1
𝑟𝑖 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 3 )
2
𝑣𝑖 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 + 𝑂(𝑑𝑡 2 )

1
Recall, 𝑠 = 𝑢𝑡 + 𝑎𝑡2 𝑎𝑛𝑑 𝑣 = 𝑢 + 𝑎𝑡
2
Integration Algorithms: Essential Idea

[r(t),v(t),f(t)] [r(t+dt),v(t+dt),f(t+dt)] [r(t+2dt), v(t+2dt), f(t+2dt)]

r(t+dt)

r(t)
r(t+2dt)
f(t)dt2/2m
• The aim is to reproduce the phase-space trajectory of the
system as accurately as possible
• Sources of errors: Poor choice of the force-field, large dt,
inadequate integration algorithm

Phase-space Trajectory

Energy
p

r Simulation Time

31
Finite difference method
Integration of Equation of Motion (Taylor Expansion) :
1
𝑟𝑖 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 3 )
2
𝑣𝑖 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 + 𝑂(𝑑𝑡 2 )
1
Recall, 𝑣 = 𝑢 + 𝑎𝑡 𝑎𝑛𝑑 𝑠 = 𝑢𝑡 + 𝑎𝑡2
2

MD Time Step

• Too long dt: Energy is not conserved


• In practice, dt ≤ 2 fs
• MD is limited to ~1-100 µs

Time step dt is chosen to balance efficiency and accuracy of energy conservation


Integration Algorithms
Any practical algorithm
should be fast, less memory consuming, should permit long dt, follow
conservation laws, time reversible and easy to program/implement.

(1) Predictor-corrector algorithm


(2) Verlet Algorithm

33
Integration Algorithms
(1) Predictor-corrector algorithm
Predictor step: Simple Taylor’s expansion
1
𝑟𝑖 𝑃 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 3 )
2
𝑣𝑖 𝑃 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 + 𝑂(𝑑𝑡 2 )

𝑎𝑖 𝑃 𝑡 + 𝑑𝑡 = 𝑎𝑖 𝑡 + 𝑂(𝑑𝑡) Where is equation of motion in this eq.?

Corrector step: Using 𝑟𝑖 𝑃 𝑡 + 𝑑𝑡 calculate the force 𝑓𝑖 𝑡 + 𝑑𝑡 and correction


in the acceleration as ∆𝑎𝑖 𝑡 + 𝑑𝑡 = 𝑎𝑖 𝑐 𝑡 + 𝑑𝑡 - 𝑎𝑖 𝑃 𝑡 + 𝑑𝑡

𝑟𝑖 C 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑃 𝑡 + 𝑑𝑡 + 𝐶0∆𝑎𝑖 𝑡 + 𝑑𝑡
𝑣𝑖 C 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑃 𝑡 + 𝑑𝑡 + 𝐶1∆𝑎𝑖 𝑡 + 𝑑𝑡
𝑎𝑖 C 𝑡 + 𝑑𝑡 = 𝑎𝑖 𝑃 𝑡 + 𝑑𝑡 + 𝐶2∆𝑎𝑖 𝑡 + 𝑑𝑡

𝐶0, 𝐶1 and 𝐶2 are the constants. Usually, 𝐶0 = 0, 𝐶1 =0 and 𝐶2 =1 are used in one of the Gear
scheme and hence called as Gear predictor-corrector algorithm.
34
Integration Algorithms
(2) Verlet Algorithm and Its Variants: (i) Leap-frog and (ii) Velocity-Verlet
1
𝑟𝑖 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 3 )
2
1
𝑟𝑖 𝑡 − 𝑑𝑡 = 𝑟𝑖 𝑡 − 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 − 𝑂(𝑑𝑡 3 )
2
Position by adding

𝑟𝑖 𝑡 + 𝑑𝑡 = 2𝑟𝑖 𝑡 − 𝑟𝑖 𝑡 − 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 4 )

Velocity by central difference method

𝑟𝑖 𝑡 + 𝑑𝑡 − 𝑟𝑖 𝑡 − 𝑑𝑡
𝑣𝑖 𝑡 = + 𝑂(𝑑𝑡 2 )
2𝑑𝑡

35
(i) Leap-frog: Velocities are explicitly calculated and slightly faster
Calculation for the advancement of velocity leaps over that for position
𝑑𝑡 𝑑𝑡
𝑣𝑖 𝑡 + = 𝑣𝑖 𝑡 − + 𝑎𝑖 𝑡 𝑑𝑡 + 𝑂(𝑑𝑡 2 )
2 2
𝑑𝑡
𝑟𝑖 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 + 𝑑𝑡 + 𝑂(𝑑𝑡 2 )
2
1 𝑑𝑡 𝑑𝑡
𝑣𝑖 𝑡 = 𝑣𝑖 𝑡 + + 𝑣𝑖 𝑡 −
2 2 2

(ii) Velocity-Verlet: Slightly slower but more accurate


1
𝑟𝑖 𝑡 + 𝑑𝑡 = 𝑟𝑖 𝑡 + 𝑣𝑖 𝑡 𝑑𝑡 + 𝑎𝑖 𝑡 𝑑𝑡 2 + 𝑂(𝑑𝑡 3 )
2
1
𝑣𝑖 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑡 + 𝑎𝑖 𝑡 + 𝑎𝑖 𝑡 + 𝑑𝑡 𝑑𝑡 + 𝑂(𝑑𝑡 2 )
2
Velocity is calculated in two steps
𝑑𝑡 1
𝑣𝑖 𝑡+ = 𝑣𝑖 𝑡 + 𝑎𝑖 𝑡 𝑑𝑡
2 2
𝑑𝑡 1
𝑣𝑖 𝑡 + 𝑑𝑡 = 𝑣𝑖 𝑡 + + 𝑎𝑖 𝑡 + 𝑑𝑡 𝑑𝑡
2 2 36
MD in NVT Ensemble

System
time
… System …
time
System
time

NVT NVT NVT

Thermostat Thermostat Thermostat


MD in NPT Ensemble

Barostat Barostat Barostat

System …
time System …
time
System time

NPT NPT NPT

Thermostat Thermostat Thermostat


Initial Velocities

Maxwell-Boltzmann distribution

• The probability of finding a particle with speed


1/ 2
 m   1 
P( v x ) =   exp − mv 2x / k BT 
 2k BT   2 
• Generate random initial atom velocities from MB

• Scaling T using Equipartition Theorem


3 1
k BT = mv 2
2 2
MD in NVT Ensemble

Ensure that

• Rescaling of velocities
• Weak coupling with heat bath
• Stochastic coupling
• Nose-Hoover method or Extended System Method
Rescaling of velocities
Define an instantaneous temperature T(t)
Weak coupling with heat bath
• Temperature may also be controlled using the method of weak
coupling to a thermal bath proposed by Berendsen (J. Chem. Phys. 81,
3684 (1984)).

• In this case, coupling either removes or adds energy to the system


to maintain constant temperature.

• The velocities are scaled at each step so that the rate of temperature
change is given by

𝑑𝑇 (𝑇0 −𝑇)
= where T0 is the target temperature.
𝑑𝑡 𝜏

• The above equation implies that if T<T0, the temperature will


increase, but if T>T0, the heat will be removed.
𝑑𝑇 𝑑𝑡 𝑇0 − 𝑇 = 𝑇 ′
‫ 𝑇( ׬‬−𝑇) = ‫𝜏׬‬ +𝐶 −𝑑𝑇 = 𝑑𝑇′
0

𝑡
−ln(𝑇0 − 𝑇) = +𝐶
𝜏

𝑡
(𝑇0 − 𝑇(𝑡)) = 𝑒 −𝐶 𝑒 −𝜏
𝑡

(𝑇0 − 𝑇(𝑡)) = 𝐴𝑒 𝜏

𝑡

𝑇0 − 𝑇 𝑡 = [𝑇0 − 𝑇 𝑡 = 0 ]𝑒 𝜏

𝑡

𝛥𝑇 𝑡 = 𝛥𝑇 𝑡 = 0 𝑒 𝜏

The deviation 𝛥T t = 0 from the target temperature


decays exponentially with time constant τ. Practically, τ = 0.1 − 1 ps
Let the velocities be rescaled as vi,a’=λvi,a. Then the change in kinetic
energy upon rescaling is

kin

The above eqn can be converted to express temperature change as

Approximating dΤ/dt with ΔΤ/Δt we get

which gives the relation between scaling factor λ, the time step Δt
and the coupling constant (the time interval between heat exchanges
with the bath) τ.
Stochastic Coupling (Andersen thermostat)
• A simple method for temperature control was proposed by
Andersen (J. Chem. Phys. 72, 2384 (1980)).
• In this method, each atom at each integration step is subject to small probability
to experience collision with heat bath.

Let us denote the frequency of collisions as ν. If collisions are uncorrelated, then the
probability of next collision event is given by a Poisson distribution
P(t)=νexp(-νt)
In the limit of small time steps Δt (i.e., << 1/ν) the probability of collision is νΔt. If an
atom collides with the heat bath, its velocity is drawn from a MB distribution.
Importantly, the velocities of other atoms are not affected.

• It has been rigorously shown that by mixing deterministic MD with stochastic


collisions Andersen thermostat creates a canonical (NVT) ensemble.
• It is important to keep in mind that Andersen thermostat breaks the continuity of MD
trajectories and does not preserve energy and momentum.
• Case1: Rare collisions do not create sufficient temperature fluctuations and the
system remains close to microcanonical.
• Case2: Too frequent collisions effectively turn Andersen scheme into velocity
reassignment.
MD in NVT Ensemble Using
Nose-Hoover Thermostat

time
System
NVT
… System
NVT

time

Thermostat Thermostat
Extended Extended
System; NVE System; NVE
Ensemble Ensemble
Nose-Hoover Thermostat
• Nose and Hoover proposed a method that generates a canonical
ensemble (J. Chem. Phys. 81, 511 (1984); Mol. Phys. 52, 255 (1984); Phys. Rev.
A 31, 1695 (1985)).
• Let us add to the energy function a fictitious degree of freedom
(coordinate) s, which represents a heat bath.
• The potential energy associated with s is gkBT ln s, where g=(3N+1)
is the total number of degrees of freedom.
• The kinetic energy related to s is Q(ds/dt)2/2, where Q plays the role
of fictitious mass.
• Consider an extended system, which includes a real system and a
heat bath represented by s, and assume that the extended system is
microcanonical.
Nosé-Hoover Thermostat (Extended system )
Lagrangian

( )
N
1 2 2 1 2 g
L Nose =  ms ri − U r −
N
+ Qs − ln s
i =1 2 2 
Hamiltonian Extended system 3N+1 variables
N
HNose =  ri pi + sps − L ( x, xr) ṙ Associated mass
i =1

pi2 ps2
( )
N
g
HNose = + + U r + ln s
N

i =1 2ms
2
2Q 
L L
pi = = ms 2 ri ps = = Qs
ri s
Conjugate
momentum
• The coupling between actual system and thermostat is controlled by Q.
• Small Q leads to high frequency oscillations of energy coupled with s and frequent
collisions with the real system.
• In the limit of large Q, microcanonical ensemble of real system is retained.

You might also like