In this tutorial you will learn how to perform a molecular dynamics (MD) of liquid argon using the GROMACS MD package. The goal will be to reproduce some of the results from the pioneering paper A. Rahman, “Correlations in the Motion of Atoms in Liquid Argon”, Phys. Rev. Lett. 136, A405, 1964.
Files to complete this tutorial can accessed here:
tutorial files
Introductory video about MD simulations to accompany this tutorial:
Video: Molecular Simulation
Video: Practical Exercise
GROMACS is an open source MD simulation package. On the GROMACS homepage you can find more information about the software and documentation. To run a simulation, we need three input files:
For the argon molecule, the atomic nuclei are treated as point particles and there are no bonds or angles. The starting structure was generated by placing point particles on a fcc lattice. To reproduce the results from A. Rahman’s 1964 paper, the system contains 864 argon atoms with a system density of 1.374 g/cm\(^3\)
In this case, we will use a structure file in pdb format: Ar_864.pdb. Looking at the file we see that each atom has a number, an atom name Ar and a x,y,z position. You can read more about the pdb file format here
To visualize the pdb format you can use VMD. In the terminal type:
Now in the dropdown menu from the VMD Main window select Graphics –> Representations. In the Graphical Representations window select Drawing Method –> VDW (for van der Waals radius). You should see something that looks like:
Notice that the argon atoms are arranged on a lattice to start.
Now let’s have a look at the topology file argon.top. The atomtypes section contains information about the force field parameters for each atom type. Here we have one atom type AR for the argon atoms:
The first column defines the atom type parameters for the Argon atom. The second column is the mass in a.m.u. The third column is the charge. The last two columns are the parameters for the non-bonded interaction. You can find more information about these parameters here
The instructions to run the MD simulation are contained in the MD parameter file md_run.mdp. Have a look at this file. The beginning section defines the MD simulation run parameters. Here we use the leap-frog integrator with a time step of 0.002 ps for 50000 steps.
The next section controls how often to print to the output files that will be generated during the simulation. The remain sections specify more details about the simulation. The temperature is controlled with the following section:
In the above we set the reference temperature to 94.4 K. The last section specifies that GROMACS should generate initial velocities of particles by randomly drawing from a Maxwell-Boltzmann distribution at 94.4 K.
Running an MD simulation in GROMACS requires two steps. First, we use the Gromacs preprocessor command grompp to prepare a binary run input file that GROMACS can read and execute. Second, we run the simulation using the mdrun command. First run the GROMACS preprocessor by typing the following in the terminal:
Here the -f flag indicates the input MD parameter file, the -c flag indicates the input structure file, the -p flag indicates the input topology file. The -o flag specifies the output file name which is the binary run input file. Now we are ready to run the simulation using the mdrun command:
The -s flag signals the input binary run input file. The rest of the flags indicate output files that will be produced as the simulation runs. The -o flag specifies the trajectory file, the -x flag specifies the output trajectory in compressed binary format, the -cpo flag is a checkpoint file, the -c flag is the output coordinates, the -e flag specifies the output energy file, and the -g flag indicates the output log file.
During this 100 ps simulation, the Argon atoms should melt from the lattice structure and become a liquid. The temperature should equilibrate to 94.4 K and the potential energy should reach a stable equilibrium. To check the temperature and energy, we can look at the instantaneous quantities in the md_run1.edr file. To check the temperature:
Type “8 0” at the prompt to select the temperature and hit enter. The temperature.xvg file will have the time vs. temperature over the course of the simulation. You can plot this with any plotting tool. For example, in xmgrace:
See if you can repeat this procedure to plot the potential energy. Does the potential energy reach a stable equilibrium?
The first run was to melt the Argon atoms from the lattice and generate an equilibrated liquid at 94.4 K. Now we can run a longer simulation that we can use to compute properties of the liquid. Have a look at the MD parameter file: Ar_nvt.mdp. This file should look very similar to the previous MD parameter file with a few exceptions. First, we specify that this will be a continuation from a previous simulation. Second, we are no longer generating velocities since we are continuing from our previous simulation.
Now we run the GROMACS preprocessor to generate a new binary run input file for the longer simulation:
Notice here the input coordinate file is the md_run1.gro file that we generated in our previous simulation. This is the final coordinates from our equilibration simulation. Also, we have added the -t flag to indicate to restart the simulation from the previous checkpoint file. Now we run the simulation as before with:
This will generate a 1 ns (1000 ps) trajectory.
If we want to visualize the trajectory we can use vmd. Type in the terminal:
Again go to Graphics –> Representations and choose Drawing Method –> VDW. You can now play the trajectory. Tip: You can also display the simulation box with the tcl command (type at the VMD> prompt:)
To compute the radial distribution function type:
When prompted select Group 0 for the ‘ref’ and Group 0 for the ‘sel’ and then type Ctrl-D to run the calculation. This will produce the output radial distribution function as a data file that you can plot in your favorite plotting program. For example, in xmgrace:
An example is shown here:
How does this compare with the results from Rahman’s 1964 paper?
Another quantity of interest is the mean squared displacement of the atoms. This can be used to analyze the self diffusion of Ar atoms from the Einstein relation: \(\lim _{t \rightarrow \infty}\left\langle\left\|\mathbf{r}_{i}(t)-\mathbf{r}_{i}(0)\right\|^{2}\right\rangle=6 D t\)
To calculate the mean squared displacement:
Select group 0 for System when prompted. Here we see that fitting the mean squred displacement from 100 to 900 ps gives:
The value from Rahman’s 1964 paper is \(D=2.43\times 10^{-5}\) cm\(^2\)/s.
A Lennard-Jones fluid can undergo a liquid to solid phase transition at low temperatures. The MD parameter file Ar_anneal.mdp will cool the system from 94.4 K to 10 K. To run this simulation starting from our previous simulation, type:
followed by
See if you can make a plot of the temperature as a function of the simulation time. Does the temperature behave as you expect?
When does the freezing begin?
Compute the radial distribution of the sold state by taking account of only the second half of the simulation.
How does the radial distribution function compare to the liquid?
How do your results change for the smaller noble gas neon. (Hint: here is a set of simulation parameters for neon: neon.top)