Sie sind auf Seite 1von 41

Molecular Dynamics Simulation

by Nneoma Ogbonna Supervisor: Kristian M ller-Nedebock u

African Institute for Mathematical Sciences Muizenberg, South Africa. May, 2004.

Abstract Molecular Dynamics simulation is a technique for computing equilibrium and dynamic properties of a classical many-body system. Newtons equations of motion are solved numerically, and macroscopic properties of the system are measured by applying statistical mechanics principles. In this essay, we will discuss the key ingredients in carrying out a molecular dynamics simulation. This includes the potentials used to model intermolecular interactions, the integration algorithms and the boundary conditions that are implemented. We will also discuss the Ewald summation, a technique for handling long-range interactions. We will present the results of simulations performed for a Lennard-Jones potential, and interpret the results in the context of a real gas.

AMS classication codes: 68U20, 70E55, 82B80.

Dedicated to my Parents

ACKNOWLEDGMENTS
I would like to express my sincere gratitude to the African Institute for Mathematical Sciences (AIMS) for giving me this opportunity to do a post-graduate diploma in mathematics. I especially thank Prof. Neil Turok for his foresight in founding this Institute, and for his motivation. I am also grateful to all AIMS sta for their help during my studies. I would like to thank Dr. Mike Pickles for helpful guidance.

I would like to thank my supervisor, Dr. Kristian Mller-Nedebock, for sparking my interest u in this topic and for his constant support and guidance.

ii

Contents
1 Introduction 2 Important considerations 2.1 2.2 2.3 2.4 2.5 Intermolecular Interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Short-range/Long-range Interactions . . . . . . . . . . . . . . . . . . . . . . . . . Equations of Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reduced Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 4 4 6 7 10 15 16 17 18 18 18 27 28 34 36

3 Computer Simulation 3.1 3.2 3.3 3.4 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Computing Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4 Long Range Interactions 4.1 Ewald Summation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5 Conclusion Bibliography

CHAPTER 1

Introduction
Computer simulation is a tool for studying macroscopic systems by implementing microscopic models. The microscopic model is specied in terms of molecular structure and intermolecular interactions. Results from computer simulations are compared with analytical predictions and experimental data to test the accuracy of the model. So computer simulations provide a good test for theory. Moreover, they are used to test complex models that cannot be worked out analytically. They are also used to study systems that are not accessible experimentally, and they help one to understand experiments on a microscopic level. Computer simulations are used to predict the properties of materials [1]. These predictions are subject to limitations imposed by the computer (such as computer memory, speed and precision). Molecular dynamics merges computer simulation with statistical mechanics to compute equilibrium and transport properties of a classical many-body system. Equilibrium properties include the energy, temperature and pressure of a system. Transport properties include the diffusion coecient, shear viscosity and thermal conductivity of a system. Molecular dynamics simulations take place in three steps. First, we specify the initial positions and momenta of the particles. The particles interact through a potential. So the implemented potential determines the extent to which our simulation results represent the system of interest. Second, we evolve the system according to Newtons law: F i = mi ai . Visually, the particles move around in the simulation box, tracing out trajectories in space. Third we measure physical quantities as functions of particle positions and momenta. Statistical mechanics is applied to interpret these instantaneous measurements in terms of equilibrium properties. In statistical mechanics, a macroscopic property of a system is an average of that property over all possible quantum states. This is referred to as an ensemble 1 average. The ergodic hypothesis states that the time-averaged properties of a real system are equal to its ensemble averages. So by taking the
1

An ensemble can be regarded as an imaginary collection of a large number of systems in dierent quantum

states, with common macroscopic attributes like temperature and pressure.

average of measurements in a molecular dynamics simulation, we can obtain the macroscopic properties of the system. Transport properties can also be computed from the data because the complete trajectories are available. They are dened in terms of time-dependent correlation functions at the atomic level [2, ch.5]. In this essay we will apply molecular dynamics to study some properties of a Lennard-Jones uid. The Lennard-Jones uid is an important model used to study liquids and gases. The results obtained from the simulations are interpreted in the context of a real gas. One must bear in mind that though molecular dynamics aims to study macroscopic systems, only a nite number of particles, from a few hundred to a few million, can be simulated on a computer. Real systems contain O(1023 ) particles (Avogadros number). Periodic boundary conditions are often implemented in simulations to mimic the innite bulk surrounding the sample. This and other considerations in setting up a molecular dynamics simulation, such as the integration algorithms and some models of particle interactions, are discussed in Chapter 2. In Chapter 3, results of computer simulations performed on the Lennard-Jones model are presented. We will compare these results to the well known physical properties of gases. The Lennard-Jones uid only models a class of interactions called the short-range interactions. In Chapter 4, we discuss another class of interactions, the long-range interactions, and a technique for handling them known as the Ewald summation. Molecular dynamics simulations have a wide range of applications [3]. They are used to study liquids [4], biomolecules (such as proteins and nucleic acids), crystal defects, phase transitions and polymers. Specialized molecular dynamics software are available, for example CHARMM, AMBER (for biomolecules), VMD (for biomolecules), and GROMOS.

CHAPTER 2

Important considerations
2.1 Intermolecular Interactions

Intermolecular interactions are modelled by a potential. This potential is a function of the positions of the nuclei. The potential energy due to non-bonded interactions 1 between N particles can be divided into terms that depend on individual atoms, pairs, triplets and so on:

U (rN ) =
i

1 (ri ) +
i j>i

2 (ri , rj ) +
i j>i k>j

3 (ri , rj , rk ) + . . .

(2.1)

where rN = (r1 , r2 , . . . , rN ) stands for the complete set of 3N particle coordinates. Here, 1 (ri ) represents the eect of an external eld (including the container walls), 2 (ri , rj ) represents pairwise interactions and 3 (ri , rj , rk ) three-body interactions. Most work considers only pairwise interactions, since their contribution is the most signicant. Pair potential depends only on the magnitude of pair separation rij = |ri rj |. The potential energy is then written in terms of the pair potential as U (rN ) =
i j>i

(rij )

(2.2)

The system under investigation determines the potential function implemented. The electrostatic potential (r) = q1 40 r (2.3)

models ionic interactions. Here, q 1 is the electric charge on ion 1 and 0 is the permittivity of free space. The Lennard-Jones 12-6 potential (Fig. 2.1) LJ (r) = 4 r
12

(2.4)

is typically used to model interactions between non-polar molecules. Here, represents the eective diameter of the spherical particles and
1

measures the attractive interaction. The

Non-bonded interactions are interactions between particles that are not linked by covalent bonds.

potential combines a short-range repulsive force (the 1/r 12 term) with a long-range attractive force (the 1/r 6 term). The repulsion arises from two eects. First, the penetration of one electron shell by another; the nuclear charges are no longer completely screened, and therefore repel one another. Second, Paulis exclusion principle, which states that two electrons of the same energy cannot occupy the same element of space. So when electron shells overlap, the energy of one must be increased, and this is equivalent to a force of repulsion [5, ch.1]. The attraction comes from van der Waals dispersion forces due to uctuating dipoles. The 1/r 6 term is consistent with the leading term of the 1/r expansion of dispersion energy. The 1/r 12 term has no theoretical justication; it is chosen on a practical basis (for easy computation) [6, ch.2]. The Lennard-Jones potential is simple and useful for understanding the properties of diverse systems (gases, liquids, clusters, polycrystalline materials [9]).
1.5 Lennard-Jones Potential

1.5 1

force

0.5
0.5 0

1/r12 term

0 -0.5 1/r term


6

f(r)
-1

-0.5

-1.5 -2

-1

-2.5 -3 -0.5
0 0.5 1 1.5 2 2.5 3 3.5 4

-1.5 -0.5

0.5

1.5

2.5

3.5

Figure 2.1: Lennard-Jones Potential. = 1, =1

Figure 2.2: Lennard-Jones force. = 1, 1

Other idealised pair potentials are valuable for comparison with theory and investigating general properties of a system. The hard sphere potential (Fig. 2.3) treats atoms as impenetrable hard spheres. r (r) = 0 r> r < r r > 5 (2.6) (2.5)

is the hard sphere diameter. The square-well (r) = 0

potential (Fig. 2.4)

is a simple potential for studying liquids. Here, is some multiple of the hard sphere diameter, and is the well-depth.

u(r)

r
well depth

u(r)

Figure 2.3: Hard Sphere Potential.

Figure 2.4: Square-well Potential.

The intermolecular force is the gradient of the potential with respect to particle displacements. (rij ) rij

Fi =

(2.7)

j=i

The Lennard-Jones force for = 1, = 1 is shown in Fig. 2.2.

2.2

Boundary Conditions

Although molecular dynamics aims to provide information about physical systems, only a small sample is simulated in practice. A physical system contains many moles of particles, and so is impossible to simulate exactly. The choice of boundary conditions (for example free, periodic or hard) aects the properties of the sample system. The ratio of surface molecules to the total number of molecules is more in the sample than in reality. These surface molecules experience dierent forces from molecules in the bulk. Periodic boundary conditions are implemented to mimic the innite bulk surrounding the sample, and so remove surface eects. We assume here that the system is surrounded by an innite number of identical copies, and that the particles in the simulation box move in unison with their images. Particles near the boundary of the simulation box interact with periodic

images across the boundary. The choice of the boundary is arbitrary; any space-lling convex shape can be used. Periodic boundary conditions inhibit the occurrence of long wavelength uctuations. The longest wave-length that ts into the simulation box is one for which = L where L is the length of the box. So periodic boundary conditions are not suitable when long wavelengths play an important role, for example continuous phase transitions [4, p.25][1, p.35]. Periodic boundary conditions are used in the presence of an external potential only if this potential has the same periodicity as the simulation box [4, p.26].

2.3

Short-range/Long-range Interactions

From now on, we assume that the simulation box is a cube of length L. The total potential energy of the particles in any one periodic box is U (r) = 1 2 (|rij + nL|)
i,j,n

(2.8)

where the vector n = (nx , ny , nz ), nx , ny , nz are integers, extends the interactions to the periodic boxes surrounding the simulation box in a spherical manner, and the prime over the sum indicates that the sum does not include i = j when n = 0. Intermolecular interactions can be divided into short-range and long-range interactions.

2.3.1

Short-range Interactions

The use of periodic boundary conditions solves the problem of surface molecules, but it poses another potential diculty. If there are N particles in a simulation box, we are faced with computing not only the interactions between these particles, but also interactions between each particle in the simulation box and the potentially innite array of periodic images. For short-range interactions, we assume that the potential energy of a particle is dominated by its interaction with particles that are closer than a cut-o distance r c , and so the potential is truncated at that cut-o. The error that arises from this approximation can be made arbitrarily small by choosing a suciently large rc . The often used truncation methods are: Minimum image convention : Only interactions between a particle and the closest
1 2 L.

periodic image of its neighbours is considered. The potential is in eect cut o at 7

This

truncation introduces a discontinuity in the potential function if the box is too small. The force is undened at the cut-o, and energy is no longer conserved. Also, the potential energy
1 calculation involves 2 N (N 1) terms. This calculation becomes cumbersome as the number of

particles is increased. Simple truncation : Here, we choose the cut-o radius so that r c <
1 2L

(Fig. 2.5).

The potential energy becomes: U (r) r rc U (r) = 0 r > rc (2.9)

This method reduces the number of terms involved in calculating the interactions, but like the minimum image convention, it is discontinuous at the cut-o radius, and so does not conserve energy. Truncated and shifted : The potential is truncated and shifted so that it goes to zero

smoothly at the cut o radius (Fig. 2.6). U (r) U (rc ) r rc U (r) = 0 r > rc corrects for the discontinuity of the force at r = r c [4, p.146].
1
0

(2.10)

The intermolecular forces are always nite. A further correction, the shifted-force potential,

Lennard-Jones Potential Truncated and Shifted

0.5

-0.2

rc=2

u(r)

-0.4

-0.6

-0.5
-0.8

-1
-1

0.8

1.2

1.4

1.6

1.8

2.2

1.2

1.4

1.6 r

1.8

2.2

2.4

2.6

Figure 2.5:

Simple Truncation of the

Figure 2.6: Truncated and Shifted LennardJones potential at rc = 2.5.

Lennard-Jones potential at rc = 2.

Since a short-range potential is truncated at r c , the measurements in a simulation ignore the 8

tail correction of the potential for r > r c . It may be useful to correct the measurements for this tail. The correction to the potential energy for the Lennard-Jones potential is [4, p.64] 8 N 3 3rc 1 1 3 3rc

Ur>rc =

where U , rc and are the potential energy, cut-o radius and the density in reduced units 2 ,

respectively.

2.3.2

Long-range Interactions

A long-range force is dened as a force which falls o no faster than r d , where d is the dimensionality of the system [7, p.132]. Coulomb interactions ( r 1 , see Fig. 2.7) and dipolar interactions ( r 3 ) are examples of long-range interactions for d = 3. The potential energy can be written in the form U (r) =
i<j

c (rij ) +

N 2

rc

dr (r)4r 2

(2.11)

where c is the truncated potential function, is the average number density of the particles and N is the number of particles in the simulation box. The tail correction diverges if (r) decays no faster than r 3 . Techniques for handling long-range interactions include Ewald summation, the reaction eld method, the particle-particle/particle mesh method and the fast multipole method. These are discussed in Chapter 4.
1.5 Coulomb Potential Lennard-Jones Potential 1

0.5

u(r*)

-0.5

-1

-1.5 -0.5

0.5

1.5 r*

2.5

3.5

Figure 2.7: The Coulomb potential and the Lennard-Jones potential versus intermolecular separation.
2

See section 2.5.

2.4

Equations of Motion

The classical equations of motion can be written as ri = pi /mi ; pi = F i (2.12)

These dierential equations can be solved approximately using nite dierence methods. The nite dierence methods are subject to truncation errors and round-o errors. Truncation errors arise because the algorithm is based on a truncated Taylor series expansion. Round-o errors arise from the actual implementation of the algorithm, for example the precision of computer arithmetic. The nite dierence algorithms can be classied as predictor and predictor-corrector algorithms [7, p.215]. In predictor methods, the molecular coordinates are updated from results that are either calculated in the current step or that are known from previous steps. The Verlet algorithm and the leap-frog algorithm are examples of predictor algorithms. The Verlet algorithm is derived from Taylor expansions for the position: 1 r(t + t) = r(t) + v(t)t + a(t)t2 + 2 1 r(t t) = r(t) v(t)t + a(t)t2 2 Adding these we get the Verlet algorithm: r(t + t) = 2r(t) r(t t) + a(t)t2 + O(t4 ). The truncation error is O(t4 ). The velocity of the particles is given by: v(t) = r(t + t) r(t t) + O(t2 ). 2t (2.14) (2.13) 1 a(t)t3 + O(t4 ) 6 1 a(t)t3 + O(t4 ). 6

The velocity Verlet algorithm, a variant of the Verlet algorithm, computes positions at time t + t using only positions at time t and their time derivatives. So we do not have to store the positions from two previous time-steps. The equations are: 1 r(t + t) = r(t) + v(t)t + a(t)t2 2 a(t + t) + a(t) t v(t + t) = v(t) + 2 10 (2.15) (2.16)

Predictor-corrector algorithms consist of three steps. First, we predict positions, velocities and accelerations from the results of previous time steps. Second, we compute new accelerations from the predicted positions. Third, we use these new accelerations to correct the predicted positions and their time derivatives. The Gear algorithm is an example [1, 7, 4]. Conservation of energy is an important criterion in the choice of an integration algorithm. The potential energy U and the kinetic energy K uctuate about xed values such that the total energy E = K + U remains constant. We can show that the total energy does not change in time if Newtons equations are integrated exactly: E = K +U = 1 2 1 2
N

mi
i=1 N

d 2 (x + yi + zi ) + 2 2 dt i

N i=1 N

dxi U dyi U dzi U + + dt xi dt yi dt zi xi


i=1

2mi (xi xi + yi yi + zi zi ) +
N

i=1 N

U U U + yi + zi xi yi zi

=
i=1 N

r mi ri . i +
i=1

ri .

U ri

=
i=1

r ri . (mi i Fi )

= 0. Higher order algorithms (such as the predictor-corrector algorithms) tend to conserve energy well over short periods, but suer overall energy drift for long periods. Verlet-style algorithms have moderate short-term energy conservation, but little long-term energy drift [1, p.73]. The particle trajectories are sensitive to small perturbations in the initial conditions, and to the precision and rounding method used for the oating point arithmetic. Trajectories that are initially close will diverge exponentially with time. Since the integration algorithms are not to innite precision, they will not trace out the true trajectories in phase space. This however does not have serious consequences for the following reasons: 1. All measurements involve averages which conceal the sensitivity of the trajectory. 2. The trajectories follow a shadow orbit (conserve a pseudo-Hamiltonian). A shadow orbit is an exact solution to a given set of equations that remains close to a numerically computed solution of the same set of equations for a non-trivial duration (signicantly longer than 11

the exact solution would starting at the same conditions as the numerical solution) [10, 1, p.72].

2.4.1

Liouville Formulation

Consistent with Hamiltonian dynamics, we expect the integration algorithms to be time-reversible and area-preserving3 . The predictor-corrector algorithms are not time-reversible. More importantly, most algorithms that are not time-reversible are not area-preserving [1]. The Verlet algorithm is time-reversible and area-preserving. Although these properties are not sucient to guarantee the absence of long-term energy drift, they are compatible with it. The Liouvilles theorem states that the density D of systems in the neighbourhood of some given system in phase space remains constant in time [12]. The total time derivative of this density can be written as D dD = + dt t ri .
i

D D + pi . ri pi

(2.17)

where r and p are the positions and momenta of the particles. According to the Liouville dD theorem, = 0. So we have dt D = t ri .
i

D D + pi . = iLD. ri pi

(2.18)

iL is called the Liouville operator, which we will write compactly as iL = r . +p. r p . (2.19)

The Liouville operator preserves reversibility and is symplectic (conserves volume in phase space) [8]. We shall now derive the Verlet algorithm using the Liouville approach. The aim of this derivation is to show that the Verlet algorithm is area-preserving. Therefore we expect the Verlet algorithm to have long-term energy conservation properties. Consider a dynamical variable f (rN (t), pN (t)) which depends on all the coordinates and momenta of N particles in a classical many-body system. The time derivative is
N

f =
i=1
3

ri .

f f + pi . iLf . ri pi

(2.20)

All trajectories that correspond to an energy level E are contained in a (hyper) volume in phase space. This

volume is preserved as the system is evolved according to Hamiltonian dynamics [1].

12

Formal solution to (2.20) gives f (t) = eiLt f (0) where f (t) f (rN (t), pN (t)). The exponential operator exp(iLt) is called the propagator [8]. If the Liouville operator is split such that iL = iLr + iLp (2.22) (2.21)

then the eect of each component of the propagator, exp(iL r ) and exp(iLp ), corresponds to a shift in coordinates. To show this, we insert iLr = r . in (2.21): f (t) = f (0) + iLr tf (0) + = exp(r(0)t . (iLr t)2 f (0) + . . . 2! r

)f (0) r ( (0)t)n n r = . n f (0) n! r n=0 = f [(r(0) + r(0)t)N , pN (0)] . (2.23)

Similarly, the eect of exp(iLp ) with iLp dened as iLp = p . is a shift in momenta. The components of the propagator do not commute. e(iLr t+iLp t) = eiLr t eiLp t . (2.24) p

But we want to apply each component of the propagator, exp(iL p ) and exp(iLr ), to f (t) in turn. So we can rewrite (2.24) using the Trotter Identity. The Trotter identity is given by e(A+B) = lim For large but nite M , we have e(A+B) = eA/2M eB/M eA/2M 13
M M

eA/2M eB/M eA/2M

(2.25)

eO(1/M

2)

(2.26)

Using (2.26), we can write the propagator as

eiLt = e(iLr t+iLp t) (eiLp t/2 eiLr t eiLp t/2 )M

(2.27)

where t = t/M , M =number of time-steps. Application of (e iLp t/2 eiLr t eiLp t/2 ) M times advances the system approximately through t. Applying this new operator to the function f (rN (0), pN (0)) yields:

t p(0))N ] (2.28) 2 t t t p(0))N ] = f [(r(0) + tr( ))N , (p(0) + p(0))N ] (2.29) eiLr t f [rN (0), (p(0) + 2 2 2 t t t t t p(0))N ] = f [(r(0) + tr( ))N , (p(0) + p(0) + p(t))N ] . eiLp t/2 f [(r(0) + tr( ))N , (p(0) + 2 2 2 2 2 eiLp t/2 f (rN (0), pN (0)) = f [rN (0), (p(0) + (2.30) The Jacobian of the transformation from {r N (0), pN (0)} to {rN (t), pN (t)} is the product of the Jacobian of the three transformations. Since the Jacobian of each transformation is 1, the algorithm is area-preserving. For example for (2.28), the Jacobian is
p p r p p r r r

1 0 0 1

=1

(2.31)

where p = p +

t 2 p

If we consider the overall eect of the sequence of operations, we see that p(0) p(0) + t (F(0) + F(t)) 2 t r(0) r(0) + tr( ) 2 (t)2 F(0) . = r(0) + tr(0) + 2m (2.32)

(2.33)

This is the (velocity) Verlet algorithm. Hence the Verlet algorithm is area-preserving. That it is reversible follows from the fact that the past and future coordinates enter symmetrically in the algorithm. From the Verlet algorithm in (2.13): r(t + t) = 2r(t) r(t t) + a(t)t2

14

we see that if we replace t with t r(t t) = 2r(t) r(t + t) + a(t)t2 we trace the trajectory in reverse.

2.5

Reduced Units

Physical quantities in molecular dynamics simulations are expressed as dimensionless or reduced units. This places all quantities of interest around unity, so we do not work with numbers that are very large or very small. Errors are also easier to spot since a sudden large or small number is most probably due to an error. By working in reduced units, we can use a single model to study dierent problems. The simulation results are scaled to appropriate physical units for each problem of interest. Also, the equations of motion become simplied due to the absorption of parameters dening the model into the units. The following basic units are used for a Lennard-Jones system: length

energy mass m

Using the replacements r = r/ and u = u/ , the Lennard-Jones potential becomes u (r) LJ =4 1 r


12

1 r

(2.34) ( /m 2 ), pressure P = P 3 / ,

in reduced units. Other reduced quantities are time t = t temperature T = kB T / , and density = 3 .

15

CHAPTER 3

Computer Simulation
The simulation results presented in this chapter are interpreted in the context of real gases. The ideal gas law, P V = N kB T , treats the molecules of a gas as non-interacting point particles. In practice, it serves as an approximation for a dilute real gas, where the interactions between molecules are few and infrequent. The equation of state of a real gas can be written as a virial series P N N 1 + B(T ) + = kB T V V N V
2

C(T ) + . . .

(3.1)

where B(T ), C(T ), . . . are called the virial coecients, and are functions of temperature. The rst discernable deviation from the ideal gas law (as the density of the gas increases) is due to the contribution of the second virial coecient, B(T ). Hence the second virial coecient is often the only correction that is considered. The second virial coecient is written in terms of the potential (r) as [13]:

B(T ) = 2
0

(1 e

(r) k T B

)r 2 dr.

(3.2)

This correction was included in measuring the pressure, as we shall see in Section 3.4. The simulations were constructed as follows: 1. Initialize particle positions and momenta. 2. Compute forces on particles. 3. Integrate equation of motion. 4. Measure relevant quantities. 5. Repeat (2)(4) for the designated period of time. 6. Compute averages. 16

3.1

Initialization

The initial particle positions must be chosen so that there is no appreciable overlap of atomic cores. The simplest way to do this is to place the particles on a lattice. For the simulations in this chapter, the particles were placed on a simple cubic lattice. The lattice spacing was chosen to obtain the appropriate density. The initial velocities should conform to the desired initial

Figure 3.1: Initial conguration of a simulation. Particles placed at lattice points temperature. They may be chosen randomly from the Maxwell-Boltzmann distribution f (v) = m 2kB T
3 2

exp(mv2 /2kB T ).

(3.3)

As a simple alternative, each velocity component may be chosen to be uniformly distributed in a range [vmax , +vmax ]. This approach was adopted here with v max = 0.5. Allen and Tildesley claim in [4, p.170] that the Maxwell-Boltzmann distribution is rapidly established by molecular collisions within 100 time steps. We see this in Fig. 3.2. I tested whether the velocities obey the Maxwell-Boltzmann distribution at equilibrium (Section 3.4). The velocities were corrected so that there was no overall momentum by setting the center of mass to zero. This prevents the system from drifting in space.

17

3.2

Computing Forces

The force is the gradient of the potential (2.7). I implemented the Lennard-Jones potential (2.4), and so the x-component of the force for the ith particle is given by fxi (r) = LJ (r) xi LJ (r) xi = r r 1 48xi 1 0.5 6 = 2 12 r r r

(3.4)

in reduced units.

3.3

Integration

I implemented the velocity Verlet algorithm (2.15). Unlike the plain Verlet algorithm, we do not need to store positions from two previous time-steps. The velocity Verlet algorithm calculates the velocities more accurately than the plain Verlet algorithm [7, p.233], and is more convenient to code. I used a time-step of t = 0.005.

3.4

Measurements

Equilibrium must be established before measurements can be made. The instantaneous potential and kinetic energy can be monitored to determine when the system reaches equilibrium. I let the simulation run for 1000 time-steps before taking measurements. From Fig. 3.2, we see that by 1000 time-steps, the potential and kinetic energy were uctuating about equilibrium values. The measurements involve time averages of a physical quantity A over the system trajectory 1 A = N for N time-steps. The averages are subject to systematic and statistical errors. Systematic errors are associated with numerical integration, nite size eects and interaction cut-o. Statistical errors are due to random uctuations in measurements. If the A i were independent, then the variance of the average would give a measure of its accuracy. However, the measurements are correlated [2], and 18
N

Ai (t)
i=1

250 TOT ENERGY Kinetic energy 200

250 TOT ENERGY

200

150

150

100

100

50

50

0 Potential energy

-50 0 200 400 600 800 time-steps 1000 1200 1400

-50 20000

20500

21000 time-steps

21500

22000

(a) First 1500 time-steps

(b) After 20000 time-steps

Figure 3.2: Equilibration phase for a system at T = 2 and = 0.08. Potential and Kinetic energy uctuate about equilibrium values. the variance must take this into consideration. A simpler method of determining the variance is using block averaging [2]. Averages evaluated over blocks of successive values are used to determine the variance. The physical properties measured were: energy. The potential energy is
N

Energy : The total energy in each time step E = K(t)+U (t) is conserved by Newtonian

dynamics (Fig. 3.2). In a computer simulation though, there are small uctuations in the total

U (t) =
i=1 j>i

|ri (t) rj (t)|

(3.5)

where (r) is the Lennard-Jones potential. The kinetic energy is 1 K(t) = 2


N i=1

mi |vi (t)|2 .

(3.6)

Temperature : The instantaneous temperature is computed from the equipartition 3 K = N kB T. 2

formula (3.7)

Pressure : The instantaneous pressure is computed from the virial equation.

19

1 P V = N kB T + D

N i=1

ri F i

(3.8)

where D is the dimensionality of the system. Here, 1 D


N i=1

ri F i

(3.9)

is the virial correction to the ideal gas equation. The derivation of (3.9) from the virial theorem is found in [13, ch.7]. In the case of pairwise interactions via a potential (r), (3.8) becomes 1 P V = N kB T D
N

rij
i=1

d dr

.
rij

(3.10)

The particle velocities of a gas in equilibrium obey the Maxwell-Boltzmann distribution given in (3.3). After angular integration (3.3) becomes f (v) v 2 exp(v 2 /2T ) (3.11)

in reduced units. To demonstrate this principle, I ran simulations for a dilute gas ( = 0.0011) at T = 2.28 and T = 1 and constructed histograms for the velocities. The initial velocities were drawn from a uniform distribution in the interval [0.5 : 0.5]. From Figures 3.3 and 3.4, we see that the velocity distribution of the particles approach the the Maxwell-Boltzmann distribution.

20

0.3 freq distr. Maxwell distr. 0.25

0.3 freq distr. Maxwell distr.

0.25

0.2

0.2

f(v)

0.15

0.15

0.1

0.1

0.05

0.05

0 0 1 2 3 v 4 5 6 0 0 1 2 3 4 5 6

(a) Initial distribution

(b) After 32000 time-steps

Figure 3.3: T = 1

0.25 freq distr. Maxwell distr.

0.25 freq distr. Maxwell distr.

0.2

0.2

0.15

0.15

f(v)

0.1

f(v)
0.1 0.05 0.05 0 0 1 2 3 v 4 5 6

0 0 1 2 3 v 4 5 6

(a) Initial distribution

(b) After 6000 time-steps

Figure 3.4: T = 2.28 The graphs in Fig. 3.5 were generated by taking averages over 30 runs, where each run lasted for 31000 time-steps. In order to allow the system to reach equilibrium before taking measurements, data was collected after 1000 time-steps. To cool the system (consisting 64 particles), the particle velocities were rescaled by a factor of 0.4 after each run. The graphs show that P T . Fig. 3.5(a) suggests that the system undergoes a phase transition. This is further supported by Fig. 3.5(b), which shows that the system behaves like an ideal gas when the intermolecular forces are absent. A phase transition occurs when the free energy becomes non-analytic. It is signalled by an 21

0.16

0.14

*=0.02 *=0.04 *=0.06 *=0.08

0.16

0.14

*=0.02 *=0.04 *=0.06 *=0.08

0.12

0.12

0.1
Pressure Pressure

0.1

0.08

0.08

0.06

0.06

0.04

0.04

0.02

0.02

0 0 0.2 0.4 0.6 0.8 1 Temperature 1.2 1.4 1.6 1.8

0 0 0.2 0.4 0.6 0.8 1 Temperature 1.2 1.4 1.6 1.8

(a) With intermolecular forces

(b) Without intermolecular forces

Figure 3.5: Cooling systems at constant density. abrupt change in the thermodynamic properties of a system. The thermodynamic properties of a system may be expressed in terms of the free energy and its derivatives. For instance P = F V S= F T

where P = pressure, T = temperature, V = volume and F = free energy. We do not see the full denition of a phase transition in this simulation because a nite system is used. In Table 3.1, we see that for low densities, the slope of graphs in Fig. 3.5(a) and Fig. 3.5(b) are almost equal. As the density increases, the eect of the second virial coecient becomes more pronounced, and the dierences in the slopes increase. slope density 0.02 0.04 0.06 0.08 Fig. 3.5(a) 0.019 0.034 0.049 0.06 Fig. 3.5(b) 0.02 0.04 0.06 0.08

Table 3.1: Slopes of constant density plots in Fig. 3.5(a) at high temperatures (before the kinks appear) and in Fig. 3.5(b).

22

0.25

T*=0.1 T*=0.5 T*=1 T*=1.5

0.25

T*=0.1 T*=0.5 T*=1 T*=1.5

0.2

0.2

Pressure

0.1

Pressure

0.15

0.15

0.1

0.05

0.05

0 0 1000 2000 3000 Volume 4000 5000 6000 7000

0 0 1000 2000 3000 Volume 4000 5000 6000 7000

(a) With intermolecular forces

(b) Without intermolecular forces

Figure 3.6: Plots of isotherms The graphs in Fig. 3.6 were generated by taking averages over 40 runs, with each run spanning 21000 time-steps. 125 particles were simulated. The volume was reduced by rescaling the length of the box by a factor of 0.94. Particles that lay outside the box after rescaling were replaced with the periodic image (with respect to the new box length) that was within the box. Following this, I let the system run for 1000 time-steps before taking measurements. We see from Fig. 3.6(a) that at high temperatures, the system behaves like an ideal gas (compare with Fig. 3.6(b)). When the temperature is lowered, the system deviates markedly from an ideal gas. The plot for T = 0.1 in Fig. 3.6(a) shows the pressure as fairly constant before it rises sharply when the system is compressed further. This is consistent with the nite size of real gas molecules, as opposed to the point mass approximation made for an ideal gas. Fig. 3.7 shows the P-V-T surface.

23

Figure 3.7: P-V-T surface Fig. 3.8 shows a conguration of a system of density = 0.0011 that was cooled from a temperature of T = 3 to T = 0.0004. The atoms vibrate about xed positions as a result of their thermal energy, and give rise to the graphs in Fig. 3.9 and Fig. 3.10. This behaviour is typical of a solid.

24

Figure 3.8: Conguration of a simulation after 5000 time-steps

Kinetic energy

-0.5

Energy

-1

-1.5

Total Energy -2 Potential energy

500

1000

1500

2000

2500 time-step

3000

3500

4000

4500

5000

Figure 3.9: Energy plot

25

-1.93

-1.94

-1.95

Energy
-1.96 -1.97 -1.98 0 500 1000 1500 2000 2500 time-step 3000 3500 4000 4500 5000

(a) Potential energy

0.04

0.03

0.02

Energy
0.01

-0.01 0 500 1000 1500 2000 2500 time-step 3000 3500 4000 4500 5000

(b) Kinetic energy

Figure 3.10: Energy plots.

In this chapter, we saw that the Lennard-Jones potential was a good model for the interactions between molecules of a real gas. The system under study behaved like an ideal gas at high temperatures and low density. When the temperature was lowered or the density increased, we were able to observe the eect of intermolecular forces, and at very low temperature, we observed solid-like behaviour.

26

CHAPTER 4

Long Range Interactions


In Chapter 2, a long-range potential was dened as one which decays no faster than r d , where d is the dimensionality of the system. Examples are the Coulomb and dipolar potentials which are proportional to r 1 and r 3 (in three dimensions) respectively. As shown in Fig. 2.7, the eect of the Coulomb force is felt for long distances (even after the Lennard-Jones force has worn o). In a case like this we cannot truncate the force at a cut-o radius. Instead we are faced with the computation of interactions between a particle and all the periodic images. This will require a large amount of computing power, especially as the number of simulated atoms is increased. Some techniques have been developed to deal with this problem. They include the Ewald summation, fast multipole methods, particle-particle/particle mesh methods, and the reaction eld method. The Ewald summation, particle-particle/particle mesh (PPPM) method and the reaction eld method all work by splitting the potential energy computation. In Ewald summation, one component is due to screened charges, and is computed in real space while the other component is due to a compensating charge distribution and is computed in Fourier space. The computation time of the Ewald summation is O(N 2 ). The reaction eld method works by computing the interaction of particles within a sphere of known cut-o radius, and the interaction due to the surrounding medium (of known dielectric constant) beyond the sphere. The reaction eld method is an O(N ) method (especially when time saving devices like the neighbour list are used), but has the limitation that the dielectric constant of the medium must be known [7]. The particle-particle/particle mesh scheme calculates one component of the potential as particle-particle short-range interactions. The remaining long-range contribution is solved on a mesh, usually by implementing fast Fourier transforms. The PPPM is O(N logN ) and works well for large systems. The fast multipole method is a tree algorithm and works by grouping particles into clusters. It is O(N ), and it works best with large systems. The rest of this chapter examines the Ewald summation in the context of Coulomb interac27
3

tions [1, 4]. Implementation of the Ewald sum using particle mesh Ewald and smooth particle mesh Ewald methods is found in [11].

4.1

Ewald Summation

If we consider a system of N charged particles in a simulation box (of length L) with periodic boundary conditions, we can write the Coulomb contribution to the potential energy as U= 1 2
N N

n=0 i=1 j=1

qi qj . |rij + nL|

(4.1)

The prime indicates that the sum does not include the particle j = i when n = 0 (that is, an ion interacts with its periodic images but not with itself). The vector n = (n x , ny , nz ), where nx , ny , nz are integers, extends the interactions to the periodic boxes surrounding the simulation box in a spherical manner. The electrostatic potential for an ion at position i is
N

(ri ) =
n=0 j=1

qj |rij + nL|
i qi

(4.2)

We assume the system is electrically neutral, that is

= 0.

The expression in (4.2) above converges slowly, and therefore is not evaluated directly. The trick lies in rewriting the expression for the charge density. In (4.1), the charge density is represented as a sum of functions.
N

(r) =
v=1

qv (r rv ).

(4.3)

Assume that each particle with charge q i is surrounded by a neutralizing charge distribution of equal magnitude but opposite in sign (Fig. 4.1(a)). The charge cloud screens the point charge so that the potential due to the screened charge falls to 0 rapidly at large distances. Typically, a Gaussian charge distribution is used. The potential due to the screened charges (now shortranged) constitute the real space part of the Ewald sum. To correct the screening eect, we introduce a cancelling charge cloud equal in magnitude to the point charge (Fig. 4.1(b)). This cancelling charge cloud is a smoothly varying periodic function and can therefore be represented by a rapidly converging Fourier series. The potential due to this distribution is computed as the Fourier space part of the Ewald sum. 28

(a) Screened point charges

(b) Cancelling charge distribution

Figure 4.1: The Ewald method of dealing with long-range interactions. The sums above include the interaction of each ion with the surrounding charge cloud. This self-interaction must be subtracted from the sums. The medium surrounding the periodic system also has to be taken into consideration since the system can interact with its surroundings. The Ewald formula for the potential energy of the system is:

U = Urs + Ufs + Umed Uself

(4.4)

where Urs is the potential energy computed in real space, U fs is the potential energy computed in Fourier space, Umed is the potential energy due to the medium, and U self is the potential energy due to the interaction of an ion with the surrounding Gaussian charge cloud. To obtain the components of the potential energy, we shall solve Poissons equation
2

(r) = 4(r)

(4.5)

for the electrostatic potential. We assume that the form of the Gaussian charge distribution surrounding an ion i is (r) = qi (/) 2 er .
3 2

(4.6)

29

4.1.1

Fourier Space Component of the Potential Energy

The charge density is given by


N

fs (r) =
n j=1

qj (/)3/2 exp[|r (rj + nL)|2 ].

(4.7)

Poissons equation becomes: Taking the Fourier transform :


2 2

fs (r) = 4fs (r).

(4.8)

fs (r) = = 1 V

1 V

fs (k)eik.r );
k

k = 2n/L (4.9) (4.10)

k 2 fs (k)eik.r .
k

So we have 1 V k 2 fs (k)eik.r =
k

1 V

4 fs (k)eik.r
k

k 2 fs (k) = 4 fs (k), where fs (k) =


V N

(4.11)

dr eik.r fs (r) dr e
V ik.r n j=1 N

qj (/)3/2 exp[|r (rj + nL)|2 ] qj (/)3/2 exp[|r rj |2 ] .

(using

4.7)

=
all space N

dr eik.r
j=1
2 /4

=
j=1

qj eik.rj ek

(4.12)

Hence using (4.11) 4 fs (k) = 2 k


N

qj eik.rj ek
j=1

2 /4

k=0

(4.13)

30

Therefore we can express the electrostatic potential as fs (r) = 1 V 1 V eik.r fs (k)


k=0 N k=0 j=1

4 2 q eik.(rrj ) ek /4 , 2 j k

(4.14)

and from this compute the potential energy Ufs = = = 1 2


N

qm fs (ri )
m=1 N N

1 2V 1 2V

k=0 m=1 j=1

4 2 q q eik.(rm rj ) ek /4 2 m j k (4.15) (4.16)

k=0

4 2 |fs (k)|2 ek /4 k2

where fs (k)

qi eik.rm .
m=1

(4.17)

4.1.2

Self-Interaction Component of the Potential Energy

The potential energy above contains a term due to the interaction of a point charge with the surrounding Gaussian cloud. We must therefore subtract the potential energy at the origin of the Gaussian cloud. The extra charge distribution is G (r) = qi (/) 2 er . We can compute the potential due to this charge distribution from Poissons equation. Using the spherical symmetry for the Gaussian charge cloud, we can write Poissons equation as 1 2 (rG (r)) = 4G (r). r r 2 (4.18)
3 2

31

Integrating (4.18) yields (rG (r)) r


r

dr 4rG (r)

dr 4rqi (/) 2 er
1 2

= 2qi (/) 2 er
1

(4.19)

rG (r) = 2qi (/) 2 dr er 0 = qi erf( r) qi G (r) = erf( r). r

(4.20)

At the origin of the Gaussian, r = 0. Applying lHospitals rule to (4.20), we obtain G (r = 0) = 2qi (/) 2 . Hence the potential energy due to self-interaction is Uself = 1 2
N
1

(4.21)

qi self (ri )
i=1
1

N 2 qi . i=1

= (/) 2

(4.22)

4.1.3

Real Space Component of the Potential Energy

Here, we want to compute the potential energy contribution from the screened point charges. The electrostatic potential due the a screened point charge is obtained by subtracting the potential due to the surrounding Gaussian charge cloud from the potential due to the point charge.

rs (r) = = The potential energy is then Urs = 1 2


N i=j

qi qi erf( r) r r qi erfc( r). r

(4.23)

qi qj erfc( r). r

(4.24)

32

4.1.4

Potential Energy due to Interaction with the Surrounding Medium

Instantaneous dipoles occur during the simulation, giving rise to surface charges at the boundary of the simulation sphere. The system becomes polarized, and this creates an electric eld. The medium responds with a depolarising eld. The total work needed to achieve a net polarization accounts for the potential energy due to the interaction of the system with the medium. This contribution to the potential energy corresponds to the k = 0 term that has not been included so far. For a system of charges, this energy is 2 = (2 + 1)V
N i=1 2

Umed where

ri qi ,

(4.25) ),

is the dielectric constant. If the system is embedded in a good conductor (

this term vanishes. Assuming our system is embedded in a conductor, the total electrostatic contribution to the potential energy is

U=

1 2V

k=0

1 4 2 | (k)|2 ek /4 + 2 fs k 2

N i=j

1 qi qj erfc( rij ) (/) 2 rij

N 2 qi . i=1

(4.26)

The parameter determines the shape of the Gaussian distribution, and is chosen to maximize numerical accuracy. A typical value of is 5/L [2].

33

CHAPTER 5

Conclusion
In this essay, we have studied a monoatomic uid whose particles interact via a pair potential. We saw that by implementing an eective pair potential (the Lennard-Jones potential) in the simulations, we could observe the behaviour of the system under dierent physical conditions. Although the accuracy of our results was limited by the nite size of the sample, we were able to observe a deviation of the system from the ideal gas behaviour, which we expect from the theory. We also discussed the Ewald summation, a technique for handling long-range interactions. Molecular dynamics is also applied to study systems made up of particles that possess intramolecular bonding potentials [8, 4]. This is often the case with biomolecules (such as proteins), with polymers. Furthermore, the ability of a pair potential to reproduce known behaviour has its limitations. Hence molecular dynamics is also used to study three-body potentials. This has applications for example in the study of silicon, where the three-body potentials incorporate a preferred set of bond arrangements, the tetrahedral arrangement, needed for silicon [2]. The molecular dynamics technique can also be applied to study other ensembles in addition to the constant energy ensemble (NVE) examined in this essay. The Nos`-Hoover thermostat e and the Anderson thermostat approaches to molecular dynamics are used to study constant temperature (NVT) ensembles [1]. The Monte Carlo method is another molecular simulation technique. It diers from molecular dynamics in that while molecular dynamics is deterministic (initial particle positions and momenta determine their trajectories), Monte Carlo relies on probabilities. One advantage of the molecular dynamics technique over the Monte Carlo method is that the complete trajectories are available for analysis, and so dynamic properties of a system can be computed. Finally, we mention the existence of labour-saving techniques in a molecular dynamics simulation. The force calculation is the most time-consuming part of the simulation. For a system of N (N 1) N particles, we must evaluate pair distances in order to decide which pairs interact. 2 The Verlet (or neighbour) list and the cell (or linked) list techniques can be applied to speed up 34

the force calculation [1]. The Verlet list method (Fig. 5.1) works by keeping a periodically updated list of the neighbours of each particle. These neighbours are in a sphere of radius r v > rc , where rc is the cut-o radius. Only interactions with particles within this sphere are calculated, thus saving us from computing the distance between a particle and all the other N 1 particles [1, 2, 4]. In the cell list method (Fig. 5.2), the simulation box is divided into cells of length at least equal to the cut-o radius. Each particle in a given cell interacts with only particles in the same or neighbouring cells. The cell list method is O(N ) [1, 2].

i r r
v c

Figure 5.1: Verlet list method. Particle i interacts with particles within the radius r v

Figure 5.2: Cell list method. Particle i interacts with particles in the 9 shaded cells.

35

DE

VW

HI

FG

RS

TU

PQ

bc



i
hi

@A

67

89

BC

fg  45 `a  XY de de 23 $% !  01  "# &' vw fg pq () rs tu xy hi

Bibliography
[1] D. Frenkel, B. Smit. Understanding Molecular Simulation: From Algorithms to Applications, 2nd Edition. Academic Press, London, 2002. [2] D.C. Rapaport. The Art of Molecular Dynamics Simulation. Cambridge Univ. Press, Cambridge, 1995. [3] Furio Ercolessi. A Molecular Dynamics Primer. http://www.sica.uniud.it/ercolessi/md/md. [4] M.P Allen, D.J. Tildesley. Computer Simulation of Liquids. Oxford Univ. Press, New York, 1987. [5] D. Tabor. Gases, Liquids, and Solids, and other states of matter, 3rd Edition. Cambridge Univ. Press, Cambridge, 1991. [6] Alan J. Walton. Three Phases of Matter. Oxford Univ. Press, New York, 1983. [7] R.J. Sardus. Molecular Simulation of Fluids: Theory, Algorithms and Object-Orientation. Elsevier, The Netherlands, 1999. [8] Michael P. Allen. Introduction to Molecular Dymanics Simulation. Lecture Notes, John von Neumann Institute for Computing, J lich, NIC Series, Vol. 23, p. 1-28, 2004. u [9] A.M. Krivtsov and M. Wiercigroch. Molecular Dynamics Simulation of Mechanical Properties for Polycrytal Materials. Mater. Phys. Mech. 3 (2001) p.45-51. [10] Wayne B. Hayes. Shadowing High-dimensional Hamiltonian Systems: the gravitational Nbody problem. Department of Computer Science, University of Toronto, Ontario, Canada. 2002. [11] Markus Deserno, Christian Holm. How to mesh up Ewald sums (I): A theoretical and numerical comparison of various particle mesh routines. J. Chem. Phys. 109, (1998) 7678.

36

[12] Herbert Goldstein. Classical Mechanics, 2nd Edition. Addison-Wesley Publishing Company, Philipines, 1980. [13] Benjamin Widom. Statistical Mechanics: A concise introduction for chemists. Cambridge Univ. Press, Cambridge, 2002. [14] Khadija Elbouchefry, Djalil Ayed and Onwunta Akwum. Structure Preserving Algorithms. http://www.aims.ac.za/internal/presentations.

37

Das könnte Ihnen auch gefallen