THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
Computational Chemistry - Practical 4
Molecular Dynamic Simulation of United Atom Liquid n-hexane
Outline:
1. Aims
2. Building topology file
3. Running molecular dynamics simulation
4. Analysis of results
1
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
1. Aims
The following practical deals with a MD simulation of liquid n-hexane by means of the simulation
package YASP. During the practice, you will learn how to create a topology file for n-hexane which
requires more information than that of water. You will study the torsion angle distribution as well as
the internal molecular dynamics related to torsion by comparing the simulation carried out with two
different torsion potential. Your tasks are the following:
− Build the topology file,
− Equilibrate the system,
− Analyze the sampling of the system in equilibrium trajectory.
2. Building topology file
The System
In this exercise you will use a particular model of n-hexane (fig1). The carbon atoms together with the
bound hydrogen atoms are gathered in a single super-atom named united atom, such that the molecule
consists of six interaction centers of two species, four CH2 and two CH3 united atoms (fig2). This
reduced number of degrees of freedom speeds up the simulation in contrast to a simulation where all
the atoms are explicitly taken into account. You will use a relatively small system of 100 molecules.
Fig1. n-hexane molecule. C6H14.
Fig2. n-hexane molecule with in the united atom model.
2
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
Topology file
In the topology file, the following parameters should be used:
• Atoms:
CH3
CH2
Mass m
15 u
14 u
LJ epsilon 0.73 kJ/mol 0.48 kJ/mol
LJ sigma 0.3970 nm 0.3970 nm
•
•
•
0
charge q 0
Bonds: 0.153 nm
Angles:109.47 deg (tetrahedron angle!), 520 kJ/mol rad2
Torsions:
Angle - [deg]
K [kJ/mol]
Periodicity
Dihedral
n
τ0
180
1
9.8
180
2
6.6
180
3
10.6
1. the torsion potential has the following analytic shape
3
K
V (τ ) = ∑ n [1 − cos(n(τ − τ 0 ))]
n =1 2
2. Write the topology file for a single n-hexane molecule. Use the file hexane-1.tp (copy from
directory /data/home/fleroy/students/exercises/prac4) as a starting point. It contains the
keywords and information about the file format.
3. Create the system topology file hexane-100.tp with the tool jointp.
Below is the topology file:
title:
hexane
atoms:
6
1
'CH3' 15.0 0.73 0.397 0.000
2
'CH2' 14.0 0.48 0.397 0.000
3
'CH2' 14.0 0.48 0.397 0.000
4
'CH2' 14.0 0.48 0.397 0.000
5
'CH2' 14.0 0.48 0.397 0.000
6
'CH3' 15.0 0.73 0.397 0.000
constraints:
5
1
1
2
0.153
2
2
3
0.153
3
3
4
0.153
4
4
5
0.153
5
5
6
0.153
angles:
3
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
4
1
1
2
3
109.47 520.0
2
2
3
4
109.47 520.0
3
3
4
5
109.47 520.0
4
4
5
6
109.47 520.0
torsions:
9
1
1
2
3
4
180 1
9.8
2
1
2
3
4
180 2
6.6
3
1
2
3
4
180 3
10.6
4
2
3
4
5
180 1
9.8
5
2
3
4
5
180 2
6.6
6
2
3
4
5
180 3
10.6
7
3
4
5
6
180 1
9.8
8
3
4
5
6
180 2
6.6
9
3
4
5
6
180 3
10.6
modified_nonbonded:
12
1
1
2
0.0 0.0 0.0 0.0
2
1
3
0.0 0.0 0.0 0.0
3
1
4
0.8737 0.343 0.0 0.0
4
2
3
0.0 0.0 0.0 0.0
5
2
4
0.0 0.0 0.0 0.0
6
2
5
0.7843 0.3386 0.0 0.0
7
3
4
0.0 0.0 0.0 0.0
8
3
5
0.0 0.0 0.0 0.0
9
3
6
0.8737 0.343 0.0 0.0
10 4
5
0.0 0.0 0.0 0.0
11 4
6
0.0 0.0 0.0 0.0
12 5
6
0.0 0.0 0.0 0.0
molecules:
6
1 1
2 1
3 1
4 1
5 1
6 1
basta:
4
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
3. Molecular dynamics simulation
NOTICE: Use mkmdinput to make an input file. For all the molecular dynamics here, cutoff is
1.1nm, neighbor list cutoff 1.2nm, verbose = 5. You may need copy files listed below from
/data/students/exercises/prac4: hexane-1.tp, hexane-1.co, tor1.dat , tor2.dat, tor3.dat, merge.csh,
average.cpp
a. Create a box of equilibrated liquid n-hexane starting from a one molecule coordinate file
The coordinate file hexane-1.co (copy from /data/home/fleroy/students/exercises/prac4) gives the
coordinates of one n-hexane molecule. Now place 100 molecules into a box with the tool position.
Before you run the program think about the box size. The molecules should not overlap, but the system
should neither be too dilute. To obtain a reasonable box size for 100 n-hexane molecules, you can use
density of liquid n-hexane at normal conditions to calculate it (656kg/mol, 298K). The calculated cubic
box dimension along one direction is around 2.8nm.
The system has to be equilibrated. This is done in two steps: in the first run the internal structure of the
molecule should relax, so that strong deviations of internal degrees of freedom (e.g. angles) vanish,
and overlaps of atoms are removed. In the second step the density has to be equilibrated. The system
runs until the density has reached its final value.
For equilibration, in our case, both NVT and NPT simulation are employed.
1). NVT: first, you should remove isotropic pressure coupling in the input file. Run the simulation
50000 steps with time-step (2fs) and temperature coupling time (300K, 0.2ps).
2). NPT: Now the density of the system has to be equilibrated using isotropic pressure control
(101.3 0 1.0e-6 5). Start the simulation using the final output coordinates from the last simulation as
the input coordinates. Another 50000 steps with the same time-step and the same temperature coupling
time is run.
3). NPT: equilibrate the system again with NPT but with a shorter pressure coupling time (101.3 0
1.0e-6 2). Start the simulation using the final output coordinates from the last simulation as the input
coordinates. Another 300000 steps (every 300 timestep is suggested for output) with the same timestep and the same temperature coupling time is run.
4). Monitor the density and temperature with plot_values, determing if it has equilibrated (exp.
656kg/mol, 298K). With the programs jmol or vmd, you can get an impression of the spatial structure
of n-hexane. But before that, you need get a .xyz file using:
yasp2xyz < md.co > md.xyz
b. Production simulation
Run a long simulation (about 100000 steps) using the final output coordinates from the last simulation
as the input coordinates. Use the last input file, except changing the simulation steps (keep the other
5
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
parameters the same, every 50 timestep is suggested for output). Keep the final output file and
trajectory file as the source for data analysis.
4. Analysis of results
Now the production run can be analyzed. We will use some of the tools of YASP to analyze the
behavior of the conformations.
1. Compute the average mass density of the system.
Use plot_values tool.
2. Use the program trjtors and extract data file of torsion angles time-dependence.
trjtors trj_file < template_file
For this you need to specify a template file for each torsion. Use the files tor1.dat, tor2.dat, and
tor3.dat separately as template_file for dihedral angle 1, 2, and 3. You need to create a different
directory for each torsion. For example use directory /torsion1 (head torsion) for dihedral angle 1,
including the output trajectory file, and the template file (tor1.dat) there. Using the tool trjtors, you
will obtain 100 files that represent 100 molecules with two columns, indicating time and respective
torsional angle. The output files created by trjtors are automatically named as t00001,
t00002,…t00100.
3. Merge all the files into a resulting file using merge.csh that you will copy from
/data/home/fleroy/students/exercises/prac4
./merge.csh
After running merge.csh, you obtain a file named as resultfile that includes all torsional data for 100
molecules. Use it as input file for the program torsclass to sort torsional angles into conformations.
The torsional angles are divided into three states: gauch+(0-120degree), trans (120-240), gauch- (240360), set as 1, 2, 0 .
torsclass 120 240 360 < resultfile > tors_state
The output file “tors_state” contains two columns; one is the time the other is an integer number 0, 1
or 2, denoting the state (conformation trans/gauche). You can average the state of 100 molecules by
using average with “tors_state” as input file.
average tors_state frame-number > ave_tors_state
For example, if you ran 100000 steps, and recorded a frame every 50 steps, then the parameter framenumber is 2000. You should obtain a file named as “ave_tors_state”. Use the program ccf to calculate
the autocorrelation function c(t ) defined below. However, “ave_tors_state” cannot directly be used as
input file for ccf, since ccf needs 3 columns, with the last two having the same value. Make an input
file for ccf (it expects 3columns) with “awk”.
awk ‘{print ($1, $2, $2)}’ ave_tors_state > ccf_input
6
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
You can finally get the autocorrelation function of the torsion state:
ccf <ccf_input> ccf_output
Use xmgrace ccf_output to view it.
Autocorrelation function for torsion state:
(h(t ) − h )(h(0) − h )
.
c(t ) =
(h(t ) − h ) 2
where h(t ) is the respective state (trans/gauche) at time t .
4. Follow the same procedure to calculate the other two c(t). (central torsion (tor2.dat) and the
other end torsion (tor3.dat)). For all the repeated commands, you can make a shell script
program to run in torsion2 and torsion 3.
Plot the result for every torsion on separate graphs. Plot the three results in a single figure where you
will restrict the time-scale to an interval where the decrease of the curves can clearly be seen.
5. Compute the distribution of the torsion angles.
This can be done by applying the tool distribtors. That program reads the file resultfile produced
previously. Copy from the directory /data/home/fleroy/students/exercises/prace4/ the program
distribtors to the three directories you have created for each torsion. Run it by simply typing
./distribtors
The program will ask you for the number of lines in resultfile. This can be obtained by a UNIX
command:
wc –l resultfile
Or more directly by multiplying the number of frames written in the trajectory file by the number of
molecules.
You will collect a file named tors_angl_dist.dat which contains the probability distribution of finding
an angle having a given value for the considered torsion.
Plot the results in a single figure so as to compare them.
6. Calculate the center-of-mass diffusion coefficient
First with cmtrj create the center of mass trajectory. Use msd to obtain the mean square displacement
from the trajectory. And then compute the diffusion coefficient using diffcoeff.
Both the programs msd and cmtrj need separate template files. We set msd.tpl as the template file for
msd, and cm.tpl as that for cmtrj. First, create cm.tpl with the YASP tool
mkcmtrjtemplate cm.tpl
7
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
Then extract the center of mass trajectory file by:
cmtrj md.trj cm.trj < cm.tpl
To create msd.tpl, type:
echo 1 1> msd.tpl
then use msd and diffcoeff to calculate the diffusion coefficient of n-hexane. (Remember, calculate
msd.dat from the center of mass trajectory)
7. Modifying the torsion potential.
An important advantage of the simulation approach is that it allows tuning force-field parameters in
order to understand related mechanisms.
Here, you are proposed to modify the coefficients of the torsion potential and probe the effect of such a
change on the torsion dynamics, the torsion angle distribution as well as on the mass density and the
diffusion coefficient.
Create a new directory where you will run the same simulation as previously but using a different
torsion potential. Use the same initial coordinates file, the same MD parameters files and the same
topology file where you will have replaced the torsion potential coefficients
K1 = 9.8 kJ/mol, K2 = 6.6 kJ/mol, and K3 = 10.6 kJ/mol
by
K´1 = 5.9037kJ/mol, K´2 = -1.13386 kJ/mol, and K´3 = 13.15868 kJ/mol .
Run the different steps (equilibration and production). Analyze the production trajectory the same way.
8
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
Questions
1. The torsion potential has the following analytic form:
3
V (τ ) = ∑
n =1
Kn
[1 − cos(n(τ − τ 0 ))]
2
a. Plot the torsion energy as a function of the dihedral angle varying from 0 to 360 degree for
both the potential you used on the same graph (notice that τ0 is 180 for both the potentials). This can
be achieved by using the program gnuplot. Open a gnuplot session by typing:
gnuplot
then type
f ( x) = K 1 * 0.5 * (1 + cos(3.14159 / 180 * ( x)) + K 2 * 0.5 * (1 − cos(2 * 3.14159 / 180 * ( x))) +
K 3 * 0.5 * (1 + cos(3 * 3.14159 / 180 * ( x)))
And
g ( x) = K 1' * 0.5 * (1 + cos(3.14159 / 180 * ( x)) + K 2' * 0.5 * (1 − cos(2 * 3.14159 / 180 * ( x))) +
K 3' * 0.5 * (1 + cos(3 * 3.14159 / 180 * ( x)))
plot
[0:360]
f(x), g(x)
Prepare a postscript file of your plot:
set terminal postscript color
set output ‘torsions.ps’
replot
If you need to go back to your plot
set terminal x11
Quit gnuplot by typing exit.
b. What are a trans and a gauche conformations? Suppose the plot represents the torsion
potential of the central torsion angle of n-hexane. Use Newman projection to describe the
conformations corresponding to the maxima and the minima observed in the figure.
2. Did the two torsion potentials you used yield different angle distributions? Explain why by
considering the two plots of the torsion potential and especially the barrier energy to overcome to pass
form a trans configuration to a gauche configuration.
3. a. Plot the torsion state autocorrelation functions for 3 dihedral angles (head/tail and central) and the
two different potentials.
9
THEORETICAL PHYSICAL CHEMISTRY TU DARMSTADT
b. For an auto-correlation function, what do c(t)=1 and c(t)=0 mean?
c. Suppose we would roughly fit the time decay of the auto-correlation function with an exponential
t
function having the form c0 exp − where τ is a relaxation time. Since c0 would be equal to 1, one
τ
can obtain an estimate of τ by finding at which value of t the function c(t) is equal to 1/e. Give out the
values you obtain for the relaxation time of each torsion and both the torsion potential.
d. Compare the relaxation time for head/tail torsion and central torsion. What does it mean if the
torsion has a faster relaxation time in one case compared to the other? And theoretically, which
relaxation time should be longer, the head/tail torsion or the central torsion? Explain why.
e. Consider the plot of the torsion potentials again to answer the following questions: Starting from
a gauche conformation, which potential has the lowest energy barrier to be overcome in order to reach
a trans state or a gauche state? Then, which potential do you expect to let a torsion angle loose the
memory of its state faster? Is your conclusion consistent with the calculations you carried out. Explain
why.
4. Compare the mass density you obtained with both the torsion potentials. Does the torsion potential
affect that quantity?
5. Same question for the diffusion coefficients. Compare your result to experiments:
Dn-hexane=4.15 10-9 m2s-1.
Further Readings:
1. Albert, R A and Silbey,R J, Physical Chemistry, John Wiley & Sons.(3rd ed), 2001, 784-787.
2. Leach, A.R, Molecular Modelling: Principles and Applications (2nd ed), 2001, 374-379.
4. W. Jorgensen, J. Tirado-Rives, J. phys. Chem. 1996, 100, 14508.
10
© Copyright 2026 Paperzz