Вы находитесь на странице: 1из 4

CMSC6920 Project 1: Molecular dynamics

January 2011


Classical molecular dynamics (MD) simulations are based on integrating Newtons Second Law of motion to obtain trajectories of particles interacting through
classical potentials. Typically, thousands, if not millions, of particles are simulated with MD. The applications of MD are many and varied, ranging from simulations of liquid argon atoms to better understand the process of crystallization,
to simulations of proteins embedded in lipid bilayers useful for understanding
biological functionality in such systems, to drug design.
Several very well written MD software packages are available for commercial
and academic use, and nowadays are used almost like black boxes to produce
results. The purpose of this project is to deal with some of the nuts and
bolts of integrating the equations of motion in order to better understand the
numerical methods typically employed. We will also use MD to study a physical
problem, that of diffusion in a confined liquid.
The background information on MD and details of its implementation is
provided by the class notes (and references provided therein). As a starting
point, a basic MD code is found in a .tgz file on the course website. It is a
slightly modified version of the code associated with Exercise 10 available at
molsim.chem.uva.nl/frenkel smit.
Your (hardcopy) written report should include graphs and tables as appropriate to present simulation data, along with accompanying explanatory text.
Please also email an archived version of your code, scripts and data (e.g. a single zipped tar file). The directory structure organizing your data should make
it easy to understand what you have done, and to test your results. Include
README files if necessary.

Integration of the Equations of Motion and

1. Download the starter code, which uses the basic Verlet algorithm to simulate in the N V E ensemble. Upon unpacking it with tar -zxf startercode.tgz,

you should find two subdirectories Source and Run. To compile and run
the program, do the following (you may need to change the name of the
compiler in Makefile in the Source directory).
cd StarterCode
cd Source
cd ../Run
less out
We will observe that the total energy is not constant. This is because the
code contains errors, 2 errors in integrate.f and 1 error in force.f. Find the
three errors so that the energy is conserved.
Become acquainted with the code paying attention to how it initializes
particle positions and velocities, how temperature is specified, what the
key variables are etc. The program produces a system.pbd file (Protein
database format) that contains a sequence of configurations. This file
can be used as input to viewing program such as VMD (available at
www.ks.uiuc.edu/Research/vmd) to generate a movie.
2. Using the default temperature, density and time step provided in the
run script, run the system long enough so that it well equilibrated. Plot
the potential energy as a function of time to show that it is fluctuating
about an mean value. Determine the mean value. Using the block average
method shown in class, determine the error in the mean value and provide
a plot of the variance in the mean as a function of block length. Your time
series should be long enough to produce an error of less than 1%.
3. The quality of integration of the equations of motion in the N V E ensemble
can be gauged by the energy drift

E(0) E(it)
1 X

E(t) =

Nt i=1
where E is the instantaneous total energy of the system (kinetic plus potential), t is the step size, and Nt is the total number of MD steps.
Employing the starter N V E code (and same state point as before),
produce a plot of E as a function of t. Try modifying mdloop.f
in order to calculate E. Ensure that for each t, the number of
time steps is adjusted so that the physical time is 100 reduced time
units, e.g. for t = 0.001, use Nt = 1 105 . Choose t to range
from 101 to 104 . Based on your graph, justify what a reasonable
time step is for this state point.

Employ different integrators and determine E(t = 103 ) for Nt =

1 105 . Implement Eulers method [r(t + t) = r(t) + t v(t) +
t2 f (t)/(2m); v(t + t) = v(t) + tf (t)/m] and a different Verlet
method (leap-frog or velocity Verlet), and compare with basic Verlet.
Comment on your results.


Implement in sample diff.f code to calculate the mean square displacement

(MSD) and velocity autocorrelation function (VACF) as functions of time. Using any variant of the Verlet algorithm with a time step of 0.001 in reduced
units to integrate the equations of motion to determine the diffusion coefficient
D from both the MSD and the VACF,
|~r(t) ~r(0)|
dD = lim
dt h~v (t) ~v (0)i ,

where d is the dimensionality of the system.

Run your system long enough so that the value of D obtained from the
two methods agrees to within 2%. Use multiple time origins to improve
the statistics.
Include a plot of the velocity autocorrelation function you use to calculate
Include a plot of the MSD as a function of time.

Diffusion in a pore

Rather than continuing to simulate a bulk liquid, here we will simulate a liquid
confined in a model cylindrical pore. To do this, we employ periodic boundary conditions in the z-direction, while for the x and y directions we define a
confining potential to mimic the walls of a channel or pore,

Vp (r) = 
where r = x2 + y 2 is the distance from the z-axis, and L is related to the
radius of the pore (see Fig. ??). For r > L, assume that the potential is infinite.
You will need to modify the force calculation to include the the effects of Vp in
your MD program. The system is now quasi one dimensional and we will only
concern ourselves with the mean square displacement in the z direction for the
purposes of calculating D. Be careful to handle periodic boundaries correctly.

1. Equilibrate a system of 2000 Lennard-Jone particles at T = 0.8 and =

0.95 for L/ = 5. Assume that the cross-sectional area of the pore is L2
for the purposes of calculating . Then carry out N V E simulations to
determine the MSD in the z direction, from which you should report a
value of D.
2. For the same simulation, define and calculate an appropriate radial particle
distribution density G(r) (we assume that it is independent of z). Define
it in such way that for a uniform system, G(r) = 1. You will need to build
up a histogram in a similar way to which g(r), the radial distribution
function, is calculated.
3. Repeat the previous steps to explore the behaviour of the MSD, D and
density profile as system parameters change, e.g. T , and L. Highlight
any interesting qualitative features of your findings.