You are on page 1of 29

Thermostats in Molecular Dynamics Simulations

Alden Johnson, Teresa Johnson, Aimee Khan


University of Massachusetts Amherst
December 6th, 2012
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 1 / 29
An Interest in Thermostats
Thermostat: A modication of the Newtonian MD scheme with the
purpose of generating a statistical ensemble at a constant temperature.
Match experimental conditions
Manipulate temperatures in algorithms such as simulated annealing
Avoid energy drifts caused by accumulation of numerical errors.
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 2 / 29
Statistical Ensembles
Ensemble: a large collection of microscopically dened states of a
system, with certain constant macroscopic properties
Microcanonical (NVE)

Arises in Newtonian MD simulation

Conserves total energy


Canonical (NVT)

Implement thermostats to sample from here

Relevant to real behavior in experiment


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 3 / 29
Microcanonical Ensemble
Consider an isolated system
Microstate: complete description of a state of the system,
microscopically
The probabilities of being in a certain microstate for the
microcanonical ensemble are uniform over all possible states
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 4 / 29
Canonical Ensemble
Follows a Gibbs distribution for probability p
j
of being in a given
microstate j with energy E
j
p
j
=
e
E
j
Z

, Z

j
e
E
j
=
1
k
B
T
Derivation follows from maximizing entropy
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 5 / 29
Ergodic Hypothesis
The ergodic hypothesis says the long time average of an observable f
coincides with an ensemble average of the observable f .
f = lim
t
1
t
_
t
0
f (x(s)) ds
f =
_

f (x) d(x)
where is the ensemble measure and is the phase space of the
observable.
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 6 / 29
Molecular Dynamics Simulation
Phase space is collection of positions q and momenta p of particles in
system
The Hamiltonian Form
_
dq
t
=
p
H(q
t
, p
t
) dt
dp
t
=
q
H(q
t
, p
t
) dt
H(q, p) = E
kin
(p) + V(q), E
kin
(p) =
1
2
p
T
M
1
p
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 7 / 29
Sampling from Ensembles
A canonical ensemble (constant average energy) is a distribution of
microcanonical ensembles (constant energy)
To sample from the canonical ensemble, the following thermostats
modulate the energy entering and leaving the boundaries of the
system
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 8 / 29
Velocity Rescaling
Velocities are described by Maxwell-Boltzmann distribution
P(v
i ,
) =
_
m
2k
B
T
_
1
2
e

mv
2
i ,
2k
B
T
Adjust instantaneous temperature by scaling all velocities
Average E
kin
per degree of freedom related to T via the equipartition
theorem
_
mv
2
i ,
2
_
=
1
2
k
B
T
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 9 / 29
Velocity Rescaling
Ensemble average average over velocities of all particles: dene
instantaneous temperature T
c
for a nite system
k
B
T
c
=
1
N
f

i ,
mv
2
i ,
T
c
= T until rescaling
v

i ,
=
_
T
T
c
v
i ,
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 10 / 29
Velocity Rescaling
Disadvantages

Results do not correspond to any ensemble

Does not allow the proper temperature uctuations

Localized correlation not removed

Not time reversible


Advantages

Straightforward to implement

Good for use in warmup / initialization phase


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 11 / 29
Nose-Hoover
Based on extended Lagrangian formalism

Deterministic trajectory

Simulated system contains virtual variables related to real variables

Coordinates q

i
= q
i

Momenta p

i
= p
i
/s

Time t

t
0
dt
s

s: additional degree of freedom, acts as external system


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 12 / 29
Nose-Hoover
Hamiltonian given by
H =
N

i =1
p
2
i
2m
i
s
2
+ V(q) +
Q s
2
2
+ (3N + 1)k
B
Tln s
Logarithmic term required for proper time scaling: canonical ensemble
Eective mass Q associated with s

Determines thermostat strength

Q too small: system not canonical

Q too large: temperature control inecient


Microcanonical dynamics on extended system give canonical
properties
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 13 / 29
Nose-Hoover
Disadvantages

Extended system not guaranteed to be ergodic


Advantages

Easy to implement and use

Implement as a chain

Each link: apply thermostatting to the previous thermostat variable

Increasing Q lengthens decay time of response to instantaneous


temperature jump

Deterministic and time reversible


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 14 / 29
Langevin
Consider the motion of large particles through a continuum of smaller
particles
dq
i
dt
=
p
i
m
i
dp
i
dt
=
V(q)
q
i
p
i
+ G
i

Viscous drag force proportional to velocity p


i

Smaller particles give random pushes to large particle


Fluctuation-dissipation relation

2
= 2m
i
k
B
T
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 15 / 29
Langevin
Disadvantages

Dicult to implement drag for non-spherical particles: related to


particle radius

Momentum transfer lost: cannot compute diusion coecients


Advantages

Damping + random force correct canonical ensemble

Ergodic

Can use larger time step


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 16 / 29
Andersen
Couple a system to a heat bath to impose desired temperature
Equations of motion are Hamiltonian with stochastic collision term
Strength of coupling specied by , the stochastic collision frequency
When particle has collision, new velocity is sampled from N(0,

T)
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 17 / 29
Andersen
Disadvantages

Newtonian dynamics + stochastic collisions Markov chain

Algorithm randomly decorrelates velocity: dynamics are not physical


Advantages

Allows sampling from canonical ensemble


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 18 / 29
Thermostats Summary
Thermostat Description Canonical? Stochastic?
Velocity Rescaling KE xed to match T no no
Nose-Hoover extra degree of freedom
acts as thermal reser-
voir
yes no
Langevin noise and drag balance
to give correct T
yes yes
Andersen momenta occasionally
re-randomized
yes yes
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 19 / 29
Applied Math Masters Project
Molecular Dynamics Simulation

Implemented in MATLAB and C++

Simulations in 2 and 3 dimensions

Periodic and walled boundary conditions

External elds such as gravity

Optimization

OpenMP

CUDA
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 20 / 29
Lennard-Jones Potential
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 21 / 29
Numeric Integration
Verlet Algorithm
p
n+1/2
= p
n

t
2
V(q
n
)
q
n+1
= q
n
+ tM
1
p
n+1/2
p
n+1
= p
n+1/2

t
2
V(q
n+1
)

Preserves modied Hamiltonian


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 22 / 29
Thermostat Implementation
Velocity Rescaling

p
i

_
T
T
c
p
i
Anderson

= 1%, 0.1%, 0.05%

Velocities are sampled from N(0,

T)
Langevin

BBK algorithm
p
n+1/2
= p
n

t
2
V(q
n
)
t
2
(q
n
)M
1
p
n
+
_
t
2
(q
n
)G
n
q
n+1
= q
n
+ tM
1
p
n+1/2
p
n+1
= p
n+1/2

t
2
V(q
n+1
)
t
2
(q
n+1
)M
1
p
n+1
+
_
t
2
(q
n+1
)G
n+1

chosen to be constant

2Mk
B
T

G sampled from a standard normal distribution


Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 23 / 29
Velocity Rescaling - Instantaneous Temperature
0 2000 4000 6000 8000 10000
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
T
e
m
p
time step
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 24 / 29
Anderson - Instantaneous Temperature
0 2000 4000 6000 8000 10000
0
1
2
3
4
5
6
T
e
m
p
time step


= 1%
= 0.1%
= 0.05%
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 25 / 29
Anderson - Histogram of Velocity Distribution
10 5 0 5 10
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
velocity
p
(
v
)
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 26 / 29
Langevin Instantaneous Temperature
0 2 4 6 8 10
x 10
4
1
2
3
4
5
6
7
T
e
m
p
time step


= 0.1
= 0.01
= 0.001
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 27 / 29
Langevin - Histogram of Velocity Distribution
10 5 0 5 10
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
p
(
v
)
velocity
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 28 / 29
References
Barsegov, Valeri (2007)
Dierent ensembles in molecular dynamics simulations
http://faculty.uml.edu/vbarsegov/teaching/bioinformatics/lectures/MDEnsemblesModied.pdf
Carloni, Paolo (2009)
Simulation of Biomolecules
http://www.grs-sim.de/cms/upload/Carloni/Presentations/Strodel3.pdf
Hunenberger, Philippe H. (2005)
Thermostat Algorithms for Molecular Dynamics Simulations
Adv. Polym. Sci. 173:105-149
Tuckerman, Mark E.(2010)
Statistical Mechanics: Theory and Molecular Simulation
Oxford Graduate Texts
Zhao, Yanxiang (2011)
Brief introduction to the thermostats
http://www.math.ucsd.edu/ y1zhao/ResearchNotes/ResearchNote007Thermostat.pdf
Alden Johnson, Teresa Johnson, Aimee Khan (UMass Amherst) Thermostats in MD Simulations December 6th, 2012 29 / 29

You might also like