Molecular dynamics: thermostats and barostats

Molecular dynamics meets the physical world:
Thermostats and barostats
Justin Finnerty
[email protected], 2011
Scientific theories of physical world
•Energy is invariant
•Real world has quantum selection rules
•E = PV/nRT
•With constant energy we have PV = nRT
Molecular dynamics review
Phase-space and trajectories
• State of classical system (canonical): described by position and momenta of
all particles (notation q is position and p is momentum).
• Phase space point X = (q,p) gives 6N degrees of freedom
� �
�A� =
A(q, p)P (q, p)dqdp
• Extract property from ensemble
P (q, p)
=
Q
=
• Intractable to evaluate over phase space
Q−1 e−E(q,p)/kB T
� �
e−E(q,p)/kB T dqdp
• N = 100; q, p assume +1,-1 in each coordinate; 26N ≅ 4x10180 calc of A
and E
Molecular dynamics review
Properties of ensemble average
• MD ansatz. Probability function P(q,p) means phase space is “empty” except
around local energy minima. Means integrand is near-zero (if A does no go to
∞ with increasing energy) except around local energy minima
• Key is to pick “reasonable” starting geometry
• Role of MD “equilibration” phase is to generate low-energy (high-probability)
system - “equilibration” here does not refer to chemical “equilibrium” but to
relaxing the system to get energy minima, hopefully close to the chemical
“equilibrium”.
• If we start in region with high P(q,p) energy conserving evolution over time will
continue to sample high P(q,p) phase space (note these are unique and nonintersecting trajectories)
Molecular dynamics review
Time average of trajectories
• Sampling periodically along trajectory evolving in time gives
�A�
=
�A�
=
M
1 �
A(ti )
M i
�
1 t0 +t
lim
A(t)dt
t→∞ t t
0
• MD ansatz is starting from an initial low energy phase point (ie high P(q,p))
and moving along an iso-energetic time evolving trajectory will sample
properties of interest with high probability weights
• End of sampling uses property value convergence
�
(�A� − A(ti ))2
Molecular dynamics review
pressure, temperature, volume
• Pressure (F is pairwise potential function):



N
N
|pi | 
1  1 � �
Fij |qi − qj | +
• P =
V 3 i
mi
j>i
• Temperature:
•
N
1 � |pi |2
T =
3N kB i=1 mi
• Volume:
• parameters of the unit cell
Physically important conditions
• Basic MD is constant energy: micro-canonical nVE
• Constant temperature (volume and/or pressure vary) : nVT
• Biological reactions
• Constant pressure (volume and/or temperature vary) : nPT
• Chemical reaction occurring open to the atmosphere
Control of system variables to maintain
temperature or pressure
• Stochastic methods
• constrain a system variable to preset distribution function
• Strong-coupling methods
• scale system variable to give exact preset derived value
• Weak-coupling methods
• scale system variable in direction of desired derived value
• Extended system dynamics
• extend degrees of freedom to include temperature or pressure terms
Thermostat
• Stochastic Langevin thermostat apply friction and random force to momenta
N
�
dpi
=
(Fij |qi − qj |) − γpi + Ri (t)
dt
j
• Andersen thermostat assign velocity of random particle to new velocity
from Maxwellian distribution
• Strong coupling isokinetic/Gaussian thermostat scale velocity
N
�
dpi
=
(Fij |qi − qj |) − αpi
dt
j
• Weak coupling Berendsen bath unit-cell immersed in surrounding bath at T0
�
�
N
�
dpi
p T0
=
(Fij |qi − qj |) − i
−1
dt
τT T
j
• τ is relaxation constant
Nosé-Hoover thermostat
• Hoover, Phys. Rev. A 31 (1985) 1695; S. Nosé, J. Chem. Phys. 81 (1984) 511;
S. Nosé, Mol. Phys. 52 (1984) 255
• add extra term η to the equations of motion
dp
dt
dpη
dt
=
N �
N
�
i
pη
Fij |qi − qj | −
p
Q
j>i
N
�
|pi |2
3
=
− nkB T
2mi
2
i
• The Q can be considered to be some fictional “heat bath mass”. Large Q
gives weak coupling, Nosé suggested Q ~ 6nkBT
• temperature is second-order differential
Example temperature control
6.5 Controlling the system
203
1.4
T (ε/kB)
1.3
1.2
1.1
1
LD
Berendsen
NoséHoover
0
1
2
*
3
4
5
t
Figure 6.12 The temperature response of a Lennard–Jones fluid under control of
three thermostats (solid line: Langevin; dotted line: weak-coupling; dashed line:
Nosé–Hoover) after a step change in the reference temperature (Hess, 2002a, and
by permission from van der Spoel et al., 2005.)
ṗηM =
p2ηM −1
− kB T.
(6.135)
Nosé-Hoover thermostat
• Energy (Hamiltonian H) of the simulated (physical) system fluctuates.
However, the energy of the system + heat bath (Hamiltonian H’) is conserved
H� = H +
Q 2
pη + 3nkB T f (pη )
2
• If the system is ergodic the stationary state can then be shown to be a
canonical distribution
�
�
exp −β V +
2
p
Q
+ p2η
2m
2
��
Barostats
• Weak coupling Berendsen bath
• scale each dimension by μ: where β is isothermal compressibility - don’t
need to know exactly as it appears as ratio with τ (a relaxation constant)



N
N
�
�1/3
|pi | 
1  1 � �
β∂t
F
|q
−
q
|
+
P
=
ij i
µ= 1−
(P0 − P )
j
V 3 i
mi
τ
j>i
• This is similar to the Berendsen thermostat where we scale velocities by λ.
�
�
��1/2
∂t T0
λ= 1+
−1
τ
T
• Together give realistic fluctuations in T and P (J. Chem. Phys. 81 (1984) 3684)
• Note: pressure scale dimension, temperature scale velocity
Berendson barostat
Instantaneous pressure vs time and instantaneous temperature vs time in an
MD simulation of 256 particles at a density of 0.8442, using the Berendsen
barostat to impose an instantaneous pressure jump from 1.0 to 6.0. Each
curve corresponds to a different value of the rise time constant τ
Parrinello-Rahman Barostat
• The extended dimension of Nosé-Hoover thermostat can be applied to
pressure to give a Nosé-Hoover barostat
• The Parrinello-Rahman barostat (J. Appl. Phys. 52 (1981) 7182) extended this
further by making each unit vector of the unit-cell independent so that
• as with Nosé-Hoover the volume is a variable in the simulation.
• additionally allows dynamic shape change (gives control of stress as well
as pressure)
• The additional terms in the equations of motion are of similar type to that
shown for the Nosé-Hoover thermostat (though somewhat more complex!)
might have been guessed by the title given to this subsection.
Figure 3 shows the details of the changes with the passage of
time. The MD cell, i.e., the h matrix, undergoes large and
swift changes which cannot possibly be described as elastic
deformations. In fact, as Fig. 3 shows, when equilibrium was
reached the average values of the components of h* were
(h Tl) = 5.54 ± 0.03, (h!2) = 9.76 ± 0.06,
Parrinello-Rahman barostat
• Graph of MD simulation of a metal
crystal after application of external
stress.
• Note second order decay of the
three variables hii related to the
unit-vectors
................. ,.............................
"'
does indic
after quen
only the s
but it also
shells sho
cle positio
were pres
here that
the c axis
Havi
under a c
.x TI = 20
temperatu
was no st
veal the s
ing the lo
quench te
.......
• (Temperature change is due to release
of elastic energy as crystal structure
changes)
0
ff
8
7
(a)
6
...................... ........... .......... ''' ............. " ...
o
•
500
1000
......
.............
Consequences of control method
method
pro
con
stochastic
canonical
disturb dynamics
strong coupling
canonical in phase space
non-Hamiltonian
disturb dynamic
accuracy
weak coupling
no well-defined ensemble
good for non-equilibrium
ensemble average ok
perturbation not ok
extended dynamics
canonical in configuration
space
more computation
disturb dynamics
Consequences of control method
method
pro
con
Berendsen thermostat
and barostat
fast, smooth first-order
approach to equilibrium
now considered less
reliable for simulation at
equilibrium
maintain canonical
ensemble.
Nosé-Hoover thermostat considered most reliable
and Parinello-Rahman
for simulation at
barostat
equilibrium and for
predicting thermodynamic properties
slow, second-order
approach to equilibrium
Group discussion: MD calculation process
• What impacts will the different control methods have on parallel MD code?
(steps in right square not necessarily shown in actual order)
• Pressure and temperature are global properties calculated as ensemble averages
equilibrate
solve equations of motion
pass start condition
sample
experiment
apply control
pass end condition
propagate ensemble