Académique Documents
Professionnel Documents
Culture Documents
2.
STAGES OF MD SIMULATION
Construction of the relaxed block and boundary conditions
The initial construction of the block of particles proceeds as described in the section
dealing with General Aspects of computer modeling. Non-periodic, periodic or semiperiodic boundary conditions can be used.
Initialization
Assignment of initial conditions for the equations of motion.
This may be done in two different ways:
(i)
Coordinates and velocities of the particles are given at the beginning, chosen as
time = 0.
(ii) Coordinates of the particles are given at the time = 0 and at a time t.
The precise choice of initial conditions may not be crucial since, ultimately, the
system will loose memory of the initial state. However, this depends on whether
the initial state is a physically well defined state and we investigate the dynamic
development of the system from this state or whether it is only a starting
configuration used to attain the thermodynamic equilibrium during the calculation. In
the former case we are performing a computer experiment and in the latter case we
study the thermodynamic equilibrium of a system of particles subject to certain
boundary conditions.
Equilibration
When studying the thermodynamic equilibrium the initial state is usually not an
equilibrium state in mechanical equilibrium as defined by equation (G5). Hence, the
system must be relaxed (develop in the phase space, i. e. when both particle
coordinates and velocities change) by integrating equations of motion for a number of
time steps until the system has settled to definite mean values of the kinetic and
potential energies. In this process the choice of t, which plays the role of the time
step used in the numerical integration of equations of motion, is crucial. The most
appropriate choice of t is such that it assures the stability of the solution and at the
same time the maximum possible speed of calculations. This can only be achieved
by trial and error and by gradually building up the experience.
In MD calculations the total vector of velocity V = ! v i , where v i is the velocity of
i
the particle I (a vector), must be permanently set equal to zero. This means that no
rigid body motion of the assembly takes place.
d 2 ri!
!
mi
2 = Fi
dt
(! = 1,2,3; i = 1,2,....,N)
(MD1)
where the vector ri determines position of the particle i and Fi is the force acting on this
particle (see also equations G3 and G4). Here i numbers particles and coordinates 1,
2
Energy
2, 3 in the 3D case and 1, 2 in the 2D case). Since the energy of the system, equal to the
sum of the potential and kinetic energy, is the first integral of equations of motion, it
must remain constant during integration. If it does not it indicates that the calculation is
erroneous. However, the kinetic and potential energies vary during the integration
process and settle to certain mean values when the equilibrium has been attained. This
is shown schematically in Fig. 1.
Total energy
Potential energy
Kinetic energy
Time
Fig. 1. Total, potential and kinetic energies as functions of time in MD simulations.
Verlet algorithm
Procedure employing two successive positions of the particles
At the start we specify ri ( t = 0) and ri ( t = !t ) . Using the central difference method
for numerical evaluation of the second derivative, equation (MD1) can be written as
2
( )!
d ri t
dt 2
("t )
1
$ ri t + "t # 2ri t + ri t # "t & =
%
' m Fi t
i
()
and therefore
( !t )2
()
(MD2)
(MD3.1)
F (t )
mi i
This is the basic recursion formula for the MD simulation, which then proceeds as
follows:
3
At the time step J, when particles are at positions ri (J!t ) , we evaluate the force
acting on each particle, Fi (J!t ) . Positions of particles at the time step J+1,
ri ((J + 1)!t ) , are then found using (MD3.1) with t = Jt. as
( ) (
( !t)
+
mi
()
Fi t
(MD3.2)
v i (J!t) =
(MD4)
()
()
()
()
ri t + !t = ri t + v i t
( !t)
!t +
2m i
()
Fi t
Following this equation the MD simulation can then proceeds as follows: At the time
step J, when particles are at positions ri (J!t ) and have velocities vi J!t , we
( )
evaluate the force acting on each particle, Fi (J!t ) . Positions ri ((J + 1)!t ) at the time
step J+1 are then evaluated as
( !t ) F ( J !t )
ri ((J + 1)!t ) = ri ( J !t ) + v i ( J !t ) !t +
2m i
2
(MD5)
( !t )
2m i
(MD6)
In (MD6) the average of forces in the Jth and (J+1)th iterations are used rather than
the force in the (J+1)th iteration only. (If positions in the (J+1)th iteration are already
determined then the force in the (J+1)th can be evaluated).
The two procedures are, of course, equivalent. Equation (MD3.2) can be written as
( )
( )
( )
( !t )
+
( !t)
+
mi
mi
()
Fi t
()
Fi t
Predictor-corrector algorithm
Using Taylor expansion to the third order we can write the predicted values of the
p
p
p
positions of the particles, ri , velocities, vi , and accelerations, a i in the J+1 time
step as
1 2
1
!t a i ( J!t) + !t 3 b i ( J!t )
2
6
1
v pi ((J + 1)!t ) = v i ( J!t) + !ta i (J!t ) + !t 2 b i (J!t )
2
p
a i ((J + 1)!t ) = a i ( J!t) + !tb i ( J!t)
rip ((J + 1)!t ) = ri ( J!t) + !tv i ( J!t ) +
(MD7.1)
where ri , vi and a i are the positions, velocities and accelerations in the step J; b i is
the time derivative of the acceleration in the step J. In the predictor step we take
(MD7.2)
(MD9)
The corrector step is then introduced that determines the values of ri , v i ,a i and b i in
the step (J+1) as follows:
(MD10)
The coefficients c 0 ,c1 ,c 2 and c 3 are 'suitably' chosen such as to assure stability and
fast convergence. This is again achieved through experience when using this
algorithm.
What is the best algorithm?
This cannot be decided generally since it depends on the problem. The following are
the general rules when choosing an algorithm.
1)
2)
3)
1!
A = lim(! " #) $ A(t)dt
!0
and in molecular dynamics calculations this corresponds to
6
(MD11.1)
A=
1 M
A(J"t)
M!
J=1
(MD11.2)
where M is the total number of MD steps (after equilibration!) and t the time step;
this means ! = M"t . This formula is exact only when M ! " but in practice large
values of M are used. However, how many MD steps are needed to obtain the
average value with a sufficient precision cannot be easily decided and most
commonly, it is again done by testing for several different lengths of time M!t .
Connection with Statistical Mechanics - Ergodic Theorem
In order to make a link with statistical mechanics we consider that the accessible
space for the system studied is the 3N dimensional space defined by the 3N
dimensional vector X = (r1 ,r2 ,....,rN ) , where r1 , r2 ,...., rN are the position vectors of the
particles. This vector describes possible spatial configuration of the system studied.
Similarly, accessible velocities of all the particles are described by the 3N
! = (r! ,r! ,....,r! ) . The energy of the system (kinetic plus
dimensional vector X
1 2
N
! and depends, in general, on both positions and velocities of
potential) is H(X, X)
! define a 6N dimensional space, called the
particles. Positions X and velocities X
! .
phase space of the system studied, and we denote vectors in this space Q ! (X, X)
If F(Q) is the distribution function1 in the phase space, i. e. the probability that the
! , then the
particles are in the phase space at a point defined by the vector Q ! (X, X)
average value of a physical quantity A, evaluated within the statistical physics
approach, is
A =Z
!1
"
A(Q)F(Q)dQ
(MD12.1)
F(Q)dQ
(MD12.2)
Phase space
where
Z=
Phase space
is the so called partition function; the integration extends over the whole phase
!.
space and dQ = dX dX
The ergodic theorem of the statistical mechanics links the averages over time with
averages over statistical ensembles. It states that for ! " #
1
The distribution function is defined by the physics of the problem studied. An example of the
distribution function is the Boltzmann distribution exp(!H / k B T) , where T is the temperature
and k B the Boltzmann constant.
7
A= A
(MD13)
This means that the average over time is the same as the average over the phase space
with appropriate distribution function. When evaluating average quantities it is
always assumed that = M!t is 'long enough' so that (MD13) is valid. Average
quantities of interest in MD simulations are the average energy (preserved in the
microcanonical case), average kinetic and potential energies, average stresses and
pressure and any other physical quantity one may be investigating. The instantaneous
values of some of these quantities have been defined in the Chapter General aspects
of atomistic computer modeling.
Temperature
The kinetic energy of the system determines its temperature when
!v
= 0.
1 N
3
m i v 2i = Nk B T ,
!
2 i=1
2
(MD14)
where N is the total number of particles in the system, mi the mass of the particle i
2
and v i the average of the square of the velocity of this particle. In general, if there
!
are ! degrees of freedom per particle Kinetic energy = Nk B T . (See derivation in
2
the Appendix). The situation when ! > 3 may arise, for example, when considering
molecules with internal rotational and vibrational degrees of freedom. For a twodimensional system of particles with no internal degrees of freedom ! = 2.
deal with the situation corresponding to 0K when all the velocities are zero. This can
be achieved using MD by decreasing the velocities and thus the kinetic energy
gradually to zero in the following way.
We first carry out MD simulation for a number of steps until the thermodynamic
equilibrium has been attained. At this point the temperature is finite but arbitrary.
We then set the velocities to zero and continue the MD simulations. The velocities
again become finite. After some equilibration we again set the velocities to zero and
continue the MD simulations. This procedure is repeated until the desired precision
of zero velocities is attained. At this point the potential energy is minimized.
(within the precision required). We then evaluate the average kinetic energy
1 N
2
mi < v i > and scale velocities (in the three-dimensional case) by the factor
!
2 i=1
1/ 2
#
&
%
(
3Nk BT (
%
!=% N
(
% m i < v 2i > (
%$ i=1
'(
"
(MD16)
where T is the desired temperature. This scaling restores the chosen temperature T.
The MD calculation is then restarted with velocities the magnitudes of which are
v inew = ! " v old
and carried out again for a sufficient number of steps. We then repeat
i
the above procedure iteratively until the desired temperature is attained with required
precision, i. e. when ! " 1 .
Warning: The adjustment of velocities must always be done after sufficient
number of iterations, as close as possible to the equilibrium. If the adjustment
were done too frequently equations of motion would not be really solved.
This is the simplest approach that can be employed. More sophisticated schemes, so
called thermostats, have been developed for keeping the temperature constant
during MD simulations. Examples are Andersen thermostat and Nos-Hoover
thermostat in which the exchange of heat with a bath is explicitly included (see, for
example, Frenkel and Smit: Understanding Molecular Simulation, Academic Press,
1996). In thermostats the constant temperature of the studied system is attained via a
suitable choice of boundary conditions.
probably changed although not necessarily such that the hydrostatic pressure is zero.
If periodic boundary conditions are applied the volume, of course, remains the same.
When in equilibrium we evaluate the total hydrostatic pressure of the system:
p=
!p
i=1
1 ! dV $ 2
M# &
2 " dt %
(MD17)
(p e ! p)V
(MD18)
N
where p e is the imposed external pressure (usually zero) and p = ! p i is the current
i=1
! i = ri / L
(MD19)
" d! %
1 N
1 " dV %
L = ( m i $ L i ' ) E p (L!1 , L! 2 ,...,L! N , V) + M $
) (pe ) p)V (MD20)
2 i=1 # dt &
2 # dt '&
First two terms are, of course, just the kinetic and potential energy of the system of
particles. The last two terms have the same form and correspond to kinetic and
potential energy associated with the volume. Following the standard Lagrangian
method2 the equations of motion (in the vectorial form) are
(
" d! % +
d * L2 m i $ i ' # dt & -,
*)
= .grad! E p = LFi
(MD21)
i
dt
where i = 1,2, .., N and Fi is the force acting on atom i given as !grad" E p . After
i
1/3
d 2V
M 2 = p ! pe
dt
N
(MD23)
!p ,
i
i=1
! 1 ,..., !! " ) = E # E
In the Lagrangian mechanics the Lagrangian is L( !1 ,..., ! " , !
kin
pot
and it is a
d $ !L '
!L
& # ) * # = 0
dt % !"
( !" i
i
12
Equations of motion (MD22) and (MD23) are then solved for both ! i and V using a
molecular dynamics algorithm. For example, when employing the Verlet algorithm
with velocities, we regard the right sides of equations of motion as generalized forces
and obtain according to (MD5)
( )
( )
( "t)
( )
2m i V1/ 3 J"t
( )
Fi J"t
( )
( )
"t
! (J"t ) + ( ) ( p (J"t ) # p )
V ((J + 1)"t ) = V (J"t ) + "t V
2M
! J"t
V
2
1
!
# "t ! i J"t
3
V J"t
( ) ( )
(MD24)
(
(
)
)
( )
( )
( )
( )
( )
( )
) ( )
"! !i (J + 1)#t =
( )
(MD26)
13
converges to the value for which p = p e then V! ! 0 and all the terms containing M in
the above equations converge to zero.
a3
a2
a1
ri = " a ! #
!=1
!
i
3
% $
(
$ !
r
=
a
#
'& i " ! i *) and in the matrix form ri = h # i
(MD27)
!=1
where h is the matrix with elements a "! . This introduces the scaled vectors of particle
positions ! i with components ! "i . Since we want to achieve that the cell varies in
14
time during the MD calculation we regard the vectors a ! , or alternatively the matrix
h , as dynamical variables and we have to introduce additional equations of motion
for them. This is attained by using the following Lagrangian proposed by Parrinello
and Rahman (Phys. Rev. Lett. 45, 2384, 1980; J. Appl. Phys. 52, 7158, 1981)
1 N
1
T
T!
(MD28)
L = " m i !! i G!! i # E p (r1 ,r2 , ...,rN , V) + MTr(h! h)
2 i=1
2
where the letter T denotes the transpose of a matrix. M is again a formally defined
'effective mass of the block'; in this formulation it actually has dimensions of the
mass.
The corresponding generalized equations of motion, which can again be solved using
one of the molecular dynamics algorithms, are
mi
( ) =F "m
d h!! i
dt
(h )
T "1
M!!
h=!" #
T
h! h!! i
(MD29)
(MD30)
The instantaneous stress tensor ! = " ! i , where ! i are the atomic level stresses
i=1
given by equation (G33). The matrix ! = (a 2 " a 3 , a 3 " a1 ,a1 " a 2 ) describes the size
and orientation of the cell faces.
If only pressure is considered then the cell can be taken as cubic and a "! = L# !" so
that h = LI , where I is the unit matrix, and. hT h = L2I . Taking L3 = V and inserting
these quantities into equation (MD29) yields equation (MD22). However, equation
(MD30) does not lead to (MD23) since the dynamical variables and the effective
mass describing the cell have been defined differently.
15
Fluctuations
In the thermodynamic equilibrium the fluctuation of a physical quantity A is defined
as the root mean square (RMS) deviation
A2 ! A
A
Fluctuations
<A>
time
Fig. 3. Schematic picture of fluctuations of a quantity A
16
(MD31)
1
1 M
A = lim ( ! " # ) $ A2 (t)dt = & A2 (J %t)
!0
M J =1
(MD32)
where t is the time step, M the total number of MD steps and the total time of the
MD run (after equilibration). A is given by equation (11.2).
" !E %
Specific heat at constant volume: C V = $ ' .
# !T & V
E is the energy of the system and it is identical with the Hamiltonian given by
equation (G2), i. e. it includes both the kinetic and potential energy. It follows from
the theory of fluctuations and statistical mechanics that C V is related to the
fluctuation of the energy3
2
E2 ! E
(MD33)
CV =
k B T2
If the distribution function f(Q) in (MD12) is the Boltzmann distribution then the average value of
the energy of the corresponding system is
E =
where the integration is over the whole phase space of the system. Differentiation of E with
respect to the temperature T yields
* E 2 exp (( E k T) dQ " Eexp ( ( E k T ) dQ % 2 "! E %
1
)
B
B
,)
($
' /
$# !T '& = k T2
exp
(
E
k
T
dQ
exp
(
E
k
T
dQ & /
)
(
)
, ) (
#
)
V
B
B
B
+
.
which corresponds to
"! E %
1
2
$
' =
E ( E
2 [
# !T & V k B T
17
" !H %
Specific heat at constant pressure: C p = $ ' .
# !T & p
H=E + pV is the enthalpy of the system and C p is related to its fluctuations
Cp =
H2 ! H
(MD34)
kBT 2
1 $ #V '
& )
V % #p ( T
!T =
V2 " V
V kBT
(MD35)
!A!B =
(MD36)
AB = A B
1 M
$ 1 M
'$ 1 M
'
A(J!t)B(J!t)
#
A(J!t)
"
& "
) & " B(J!t) )
M J =1
% M J= 1
( % M J= 1
(
and
(MD37)
1 # "V &
% (
V $ "T ' p
is determined by the time-independent correlation between the volume, V, and the
enthalpy, H
2
!V!H = k B T V" p
(MD39)
Isobaric thermal expansion coefficient: ! p =
19
a
strain, ! "# , in a linearly elastic material, i. e the Hooke's law ! "# =
$ ,%=1
applies. This tensor may be determined from the time-independent correlation of the
stress tensor components
%
(MD40.1)
C !"#$ =
&' !" &' #$
k BT
where the stress tensor ! "# is given by (G15). Since in equilibrium ! "# = 0
%
(MD40.2)
C !"#$ =
& &
k B T !" #$
This relationship can then be used to determine the temperature dependence of elastic
moduli in an MD calculation. However, such calculation requires extremely long
MD runs that are often unattainable.
1
B(t 2 )A( t1 ) = lim ! " # % A(t1 + t $ )B(t 2 + t$ )dt $
!0
(MD41)
In the thermodynamic equilibrium, the correlation may depend only on the difference
of the times: t 2 ! t 1 . Therefore, setting t1 = 0 and writing t instead of t2, the timedependent correlation function is
!
1
(MD42.1)
B(t)A(0) = lim ! " # % A(t $ )B(t + t$ )dt $
!0
20
(MD42.2)
where M is the number of steps of the MD calculation. The short time limit of the
correlation function is:
lim(t ! 0)[ B(t)A(0) ] = A" B
(MD43.1)
Since for t ! " A and B cannot be correlated because the events are very far from
each other in time, the long time limit of the correlation function is:
lim(t ! ")[ B(t)A(0) ] = A # B
(MD43.2)
Autocorrelations
The autocorrelation function is a special case of time-dependent correlation function
when we set A = B
1!
(MD44.1)
A(t)A(0) = lim( ! " # ) $ A(t + t' )A(t' )dt'
!0
and in the framework of MD calculations
1 M
(MD44.2)
A(t)A(0) = " A(t + J!t)A(J!t)
M J =1
The physical meaning of the autocorrelation is that we ask how long the system
remembers that a quantity A had some value at a given time. The short time limit
of the autocorrelation functions is:
lim(t ! 0) A(t)A(0) = A 2
(MD45.1)
(MD45.2)
The autocorrelation function A(t)A(0) therefore varies between these two extreme
2
values and practically reaches A after the correlation or relaxation time defined as
#
! cor = 2
$ ( A(t)A(0)
" A
A2 " A
) dt
(MD46)
The reason for this definition is explained in Fig. 4, where the autocorrelation
function is shown schematically as a function of time. We define the correlation
2
time, ! cor , as a time when the autocorrelation function approaches closely A . In
this case the area of the right-angled triangle marked by bold lines,
1
(A
! A
)"
cor
and the two sides of the same triangle. This area is given by the integral
" cor
#
0
A(t)A(0) ! A
) dt .
Since we assume that for time ! cor the autocorrelation function is very close to A ,
"
# ( A(t)A(0)
! A
) dt .
the area of the right-angled triangle marked by bold lines, leads to the formula
(MD46) for the correlation time.
2
A
Autocorrelation
Time
!cor
d(! " ! )
= "#(! " ! )
dt
dissipation
(MD47)
where is the linear dissipation coefficient associated with the physical quantity .
The term !" (# ! # ) represents the frictional force that opposes the change of . If
dissipates from some value ! then it follows by integrating equation (MD47) that
the dissipation process decays exponentially and thus
! = (! " !)exp("#t) + !
(MD48)
The mobility related with this dissipation process is then defined as ! = 1/ " and
according to the Green-Kubo equation it is determined by the time integral of the
autocorrelation of as follows4
1 "
(MD49)
! = 2 # !( t)! (0) dt
! 0
If !(t ) = d"(t) dt then the corresponding 'Einstein relation' is associated with
(MD49) that follows by integration by parts
2
1 1
1
(MD50)
! =
lim
"
#
$
B(")
%
B(0)
2 !2
"
) (
In practice, must be much larger than the correlation time for in order to evaluate
! with sufficient precision.
According to the fluctuation-dissipation theorem the dissipation coefficient, ,
determining the rate of dissipation of fluctuations also determines, in the linear
4
M. S. Green, J. Chem. Phys. 22, 398, 1954; R. Kubo, J. Phys. Soc. Japan 12, 570, 1957; Rep.
Prog. Phys. 29, 255, 1966; R. Kubo, M. Toda and N. Hashitsume, Statistical Physics II, Springer:
Berlin, 1985).
23
approximation, the dissipation rate if the deviation away from ! is induced by some
external action.
Self-diffusion coefficient
As first shown by Einstein when studying the Brownian motion, the self-diffusion
coefficient, D, is related to the mobility, v , associated with the velocity of the
particles, according to the relation D = v k B T / m, where m is the mass of the
particles. Hence, if we identify with the vector of the velocity, v, then
v =
1
v2
$"
0 ! =1
v ! (t)v ! (0) dt
(MD51.1)
D=
k BT
v2 m
$"
0 ! =1
1# 3
1#
v ! (t) v! (0) dt = $ " v ! (t )v ! (0) dt = $ v(t)iv(0) dt (MD51.2)
3 0 ! =1
30
Furthermore, the
(MD52)
where r is the position vector. In practical calculations ! must be much larger than
the correlation time for r .
Tensor of viscosity
In a linearly viscous material the tensor of viscosity, ! "#$% , relates linearly the applied
stress,
a
! "# ,
! a"#
% ,&=1
This tensor is determined by the integral of the time dependent autocorrelation of the
stress tensor components
&o (
(MD53)
! "#$% =
' (t)' $% (0) dt
k B T )0 "#
where the stress tensor ! "# is given by equation (G15); ! o is the average volume per
particle.
24
In liquids, which are by definition isotropic, there are only two components of the
viscosity:
(i) The shear viscosity determined by the autocorrelation of shear stresses:
"o &
(MD54.1)
!s =
# (t )# $% (0) dt
k B T '0 $%
where ! "# ( ! " # ) is a shear component of the stress tensor given by (G15).
(ii) The bulk viscosity determined by the autocorrelation of the hydrostatic
pressure:
"o #
!V =
p(t)p (0) dt .
k B T $0
(MD54.2)
Additional literature
D. Chandler: Introduction to Modern Statistical Mechanics, 1987, Oxford: Oxford
University Press.
M. P. Allen and D. J. Tildesley: Computer Simulation of Liquids, 1987, Oxford:
Oxford University Press.
J. P. Boon and S. Yip: Molecular Hydrodynamics, 1980, New York: McGraw-Hill;
also Dover Publications, 1991.
D. Frenkel and B. Smit: Understanding Molecular Simulations, Academic Press, New
York, 1996.
25
Edf = 1 mv 2
kin
2
Edf =
)0 12 mv
(
kin
2 exp " ! mv 2
$#
"
)0 exp $#! mv
2k BT %' dv
&
2k BT %' dv
&
mv 2 2k BT = x 2 ! v = x 2k BT m
and thus
&
Edf = k BT
kin
)x
)
0
'0 x
exp "# !x 2 $% dx
&
2$
dx
Edf = k BT .
kin
E = N !k BT
2
This is the equipartition theorem that represents for the system of N particles the definition of the
temperature
26