Talk:Mod:ASP9395
JC: General comments: Excellent report, all sections were answered very thoroughly with a lot of extra relevant detail. Explanations were well written, clear and focused, well done.
First Simulation
Simple Harmonic Oscillator
In order to demonstrate a simple molecular simulation, a model classical harmonic oscillator was established. The velocity-Verlot algorithm was used to determine velocity, and kinetic and potential energy was evaluated at each timestep. Variation in total energy was measured for a number of different timesteps (Figures 1-2); total energy must remain approximately constant within a model system to ensure it can realistically simulate a physical system constrained by conservation of energy. Timesteps greater than 0.28 exceed a 1% deviation in energy, and ideally would not be used in such a simulation.
![]() |
![]() |
JC: Why does the error oscillate over time? Good, thorough analysis of the effect of timestep on total energy.
Lennard-Jones Potential
For a Lennard-Jones interaction, the distance at which no potential energy is present (r0) was calculated as such:
The distance at which no force is acting upon the atoms (req) was similarly calculated:
To model Lennard-Jones interactions across infinite distances, approximations must be made. One such approximation is that interactions between atoms beyond a certain separation are so small as to be ignored. The separation of 3σ is used throughout these simulations; the following calculations demonstrate the steep droppoff rate associated with such forces that justifies this arbitrary cutoff point.
When σ = ɛ = 1
This fast decay of force with distance justifies the LJ cutoff of 3σ; beyond this distance atoms have little interaction with one another and can be approximated as being independent of each other.
JC: All correct, except for r_eq sigma shouldn't be raised to the power 1/6. Good explanation of the integrals.
Scale of Simulation
The volumes that can be simulated in such a way are very limited.
1 mL water = 1 g
1 mol water = 18 g
1 mol = 6.022*1023 atoms
1 mL water = 6.022*1023/18 atoms = 3.346*1022 atoms
A simulation involving 10000 atoms of water only simulates 2.989*10-19 cm3. This demonstrates the difficulty in modelling large amounts of atoms computationally.
JC: Correct.
Periodic Boundary Conditions
JC: Good explanation and diagram. Periodic boundary conditions remove interfacial effects which would otherwise dominate the behaviour of the simulated system.
Reduced Units
In order to simplify the calculations involved in these simulations, reduced units are used:
Distance
Energy
Temperature
Time
In the case of argon, where σ = 0.34nm, ɛ/kB = 120 K, a distance of 3.2 reduced units corresponds to 1.088 nm, with a well depth of 0.998 kJ/mol. A reduced temperature of 1.5 corresponds to a temperature of 180 °C.
JC: Correct.
Equilibration
Creating the Simulation Box
When creating a simulation of thousands of atoms, they begin in positions pre-determined by a lattice structure. This is to ensure that no two particles are placed in identical or near-identical positions; this would result in an incredibly high potential-energy system, which would result in high kinetic energy and so high temperature.
The number lattice density corresponds to the side length (lattice spacing) as shown in the following equation:
Therefore a simple cubic lattice (with one lattice point per unit cell) and a density of 0.8 will have lattice spacing of 1.07722. Similarly, a face-centred cubic with density of 1.2 and 4 lattice points per unit cell will have a side length of 1.49380 reduced units.
When filling a box of 10x10x10 unit cells (volume of 1000 unit cells) with face-centred cubic lattices (which each feature 4 atoms per unit cell) using the create_atoms command, 4000 atoms would be created.
JC: Calculations are correct. Placing two atoms too close together in a starting structure would lead to very high repulsive forces which would make the simulation unstable and cause it to crash.
Interaction Commands
A number of commands are included in the input file to specify the interactions between atoms:
mass 1 1.0
The purpose of this command is to specify the relative masses of the atoms used in this system. As only one type of atom was used, only one mass was specified.
pair_style lj/cut 3.0
The pair_style command here is used to determine the type of interactions between atoms, and the distance at which atoms stop interacting. In this case, the Lennard-Jones interactions will end at a distance of 3σ.
pair_coeff * * 1.0 1.0
This specifies that all pairwise interactions have LJ coefficients σ = 1 and ɛ = 1
Given that and are specified, the integration algorithm used is the velocity-Verlet algorithm.
JC: Correct.
Defining Variables
The input file specifies a number of variables, such as:
variable timestep equal 0.001
variable n_steps equal floor(100/${timestep}) timestep ${timestep}
The purpose of defining these variables is to allow the input file to be easily adjusted. Rather than having to change both lines to specify the new timestep, only the variable timestep equal line needs to be modified, and the other lines will simply read the new timestep value from this line. In more complicated input files, this greatly simplifies the process of changing timestep.
JC: Good explanation.
Choice of Timestep
A number of simulations with differing timesteps were created, and their energy, temperature and pressure monitored (Figures 4-7).
This serves to highlight the two competing factors of any simulation: accuracy of results and time taken to perform. Clearly, a lower variation of energy, temperature and pressure are achieved using a smaller timestep, (Figure 7). However, the smaller the timestep, the greater the time required to run the simulation.
For the 0.001 timestep, the system reaches equilibrium at approximately 0.28 reduced time units (6.06*10-13 s). The energy associated with the simulation with the smallest timestep, 0.001, converges sharply to -3.184 reduced energy units. The 0.0025 timestep simulation converges to roughly the same energy (also -3.184 to 3 d.p.), but has greater variance. Greater timesteps cause average energy to increase, variance to increase, and in the case of the 0.015 timestep, the energy actually diverges (causing the simulation to become less reliable over time). This timestep therefore cannot be used in a simulation to determine the physical properties of a system.
A timestep of 0.0025 can be used as a compromise between accuracy and speed, though if time or computational resources are limited then 0.01 is suitable (with an energy value converging to approximately -3.181, representing an error of only 0.1%). For the following simulations, a timestep of 0.0025 was used.
JC: Good choice of timestep. The total energy should be independent of the timestep.
Running Simulations under Specific Conditions
Velocity Correction Coefficient
As a system fluctuates at each timestep, certain variables will need to be kept constant. In order to maintain a constant temperature, a velocity correction coefficient (ɣ) is introduced. By multiplying the velocity by this coefficient at each timestep, constant kinetic energy and therefore temperature can be maintained.
Where = instantaneous temperature and = target temperature.
JC: Correct.
The Fix Averages Command
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2
The "fix ave/time" command refers to which timestep values contribute to the final average. In this case, the average at 100000 timesteps is calculated using the value of the 1000 most recent multiples of 100 timesteps - in effect, every 100th timestep is included. If the input were:
fix aves all ave/time 100 999 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2
Then the average at 100000 timesteps would contain values from the 200th, 300th, 400th... timesteps, omitting the first 100th.
With a timestep value of 0.0025, and a total of 100000 runs, the amount of time in reduced units being simulated is 250. Using the coefficient values of argon described earlier, in real time this corresponds to 54.1 ns.
JC: Good explanation of the averaging procedure.
Plotting Equations of State

Simulations were run at pressures of 2.6 and 2.8, and temperatures of 1.7, 1.9. 2.1, 2.3 and 2.5 reduced units (Figure 8).
Note that standard deviation in density is too small for the y-axis error bars to be observed at this scale. Reduced units are used throughout to demonstrate relative differences rather than absolute values.
The simulated density is lower than that of an ideal gas at the same conditions. With an equilibrium separation between atoms (req) of 1.122σ and lattice spacing of 1.077σ, the repulsive forces between atoms outweigh the attractive at these inter-atomic distances, causing atoms to spread out from one another and decrease density (compared to the ideal gas, which by definition features no inter-atomic interactions).
Using previously established unit conversion coefficients, the pressures used (2.6 and 2.8 reduced pressure units) can be converted into real units of over 100 MPa, or over 1000 atmospheres. At pressures this high, the ideal gas model also becomes less realistic as interactions between particles become more significant. It is for this reason that at lower pressures the discrepancy between simulated results and the ideal gas law decreases.
JC: Good explanation. How does the discrepancy between simulation and ideal gas results change with temperature?
Heat Capacity
Heat capacities were calculated for two different pressures at a range of temperatures, and these values compared to the National Institute of Standards and Technology Thermophysical Properties of Fluid Systems Database (Figure 9).1
![]() |
Good agreement is found between these values, though a greater level of fluctuation is observed for the higher pressure system.
The volumetric heat capacity was also calculated for each set of conditions (Figure 10):
![]() |
Volumetric heat capacity increases with density and shows a slight decrease with temperature. Higher densities have higher heat capacities due to the greater number of atoms within each volume unit; the greater the number of atoms, the more energy must be input in order to cause them all to achieve the required increase in kinetic energy for a given temperature change.
An example input file can be found here.
JC: Great idea to compare heat capacity data to literature values. You could make your script print out the value of the heat capacity directly rather than just calculating the variance in the total energy.
Radial Distribution Function
Solid, Liquid and Gas RDF
The radial distribution function (RDF) of a system describes the likelihood of finding an atom within a certain separation distance of another. For example, in the case of Figure X, in the solid system, it is almost two times more likely that atoms will have a separation of 3.5 Å than 5.1 Å (Figure 11). These values are normalised, with the average density of atoms in the system equal to one.
RDF converges to unity over very long distances because real systems are not perfectly ordered; knowing the position of one atom does not allow you to accurately predict the position of atoms thousands of angstroms away, and therefore atom density at great distances is equal to average atom density.
![]() |
RDF values of liquids converge at a far greater rate than those of solids because they are less structured, and for the same reason, gases converge faster than liquids. The fact that peaks are still visible even at 33 Å implies a very high level of order for the solid structure, due to the restricted freedom of atoms (Figure 21).
Structure of Solid
The first three peaks corresponding to the solid RDF (at distances 3.54, 5.05 and 6.20 Å) have integral values of 12, 6 and 24 respectively (Figure 12). These three peaks correspond to the 12 nearest neighbours, 6 second-closest neighbours and 24 third-closest. These are depicted in Figure 13 as the red, yellow and green atoms respectively (with the central blue atom acting as observer) (Summarised in Table 1).
![]() |
![]() |
Neighbour Proximity | Distance /Lattice Spacing | Distance /Å | Colour | Coordination Number |
---|---|---|---|---|
First | 3.54 | Red | 12 | |
Second | 5.05 | Yellow | 6 | |
Third | 6.20 | Green | 24 |
One lattice spacing corresponds to 5.05 Å, as determined geometrically using the data in Table 1.
JC: The solid RDF decreases towards 1 at high distances because at these distances there are more possible lattice vectors (possible combinations of unit cell vectors) which are very similar in length. The liquid RDF shows short range solid like ordering, but no long range order. Diagram of lattice very clearly shows all of the atoms responsible for the first 3 peaks in the RDF. Can you calculate the lattice spacing from the first and third peaks as well and check that they agree, or calculate an average value.
Diffusion Coefficient
Mean Squared Displacement
Mean Squared Displacement (MSD) of atoms within a simulated system can be used to determine diffusion coefficient (D) (Table 1). This is a measure of the rate that particles spread out throughout a system (Figures 14-19).
Velocity Autocorrelation Function (Harmonic Oscillator)
The velocity autocorrelation function (VACF) for a simple harmonic oscillator can be determined as follows:
The RHS of the numerator is odd and so equals 0 upon symmetric integration
JC: Correct.
Velocity Autocorrelation Function (Simulation Data)
![]() |
Minima and maxima in a VACF graph describe moments when the total force acting on a particle equals zero; essentially, points at which the atom is in a low-energy state (Figure 20). These represent areas where attractive and repulsive forces from surrounding atoms are equal. In the case of solids there are many well-ordered sites of zero force in which atoms move back and forth as a damped harmonic oscillator. This represents the vibration of an atom between those surrounding it (Figure 21). These occur regularly and so further demonstrate the greater level of order found within a solid than a liquid or gas. Liquids show very few minima and maxima, and quickly converge to zero velocity as random collisions occur.

The harmonic oscillator VACF is the most regular and shows no decay. This is because it is a theoretical construct including no friction or collisions; its wavelength remains constant at approximately 40 timesteps as it oscillates backwards and forwards in a totally predictable fashion.
As more collisions occur, the velocity of each atom becomes more random (in the sense of uniform distribution between all directions), and therefore the VACF for each system converges to zero (Figures 22-27).
The diffusion coefficients of solids, liquids and gases can be determined as the integral of the VACF following convergence (Table 1).
The relatively large deviation between liquid diffusion coefficients acquired this way and using the MSD method is due to the concept of the long-time tail.2 In a liquid model using hard-sphere interactions, a moving sphere will compress the liquid in front of it, and rarefy that behind. This causes a vortex flow around the sphere, pushing it forwards and resulting in velocity decay that is much slower than exponential. This long-time tail therefore always results in a greater value of D calculated from VACF data than MSD, as shown in Table 2. This is only prevalent in the liquid system, as gases do not have a high enough density to interact in this way, and solids do not diffuse.
The simulations of gaseous systems were run again for a greater duration to ensure convergence (Figures 28 and 29).
JC: Excellent explanation of the VACF results.
![]() |
![]() |
Diffusion Coefficient Results
Phase | Density /reduced units | Density /1027 m-3 | Diffusion Coefficient (MSD Method) /10-5 cm2s-1 | Diffusion Coefficient (VACF Method) /10-5 cm2s-1 |
---|---|---|---|---|
Gas | 0.05 | 1.27 | 186 | 180 |
Liquid | 0.8 | 20.35 | 4.64 | 4.81 |
Solid | 1.2 | 30.53 | ~0 | ~0 |
The gas diffusion coefficient is of a similar order of magnitude as that found in literature.3 At the temperature used in this simulation, the literature value of the diffusion coefficient would be approximately 4600*10-9 m2/s, whereas that found in this simulation is about 170. This is because the literature values correspond to a pressure of 1.013 bar (101 kPa) and that used in these simulations was approximately 21 bar (2.1 MPa). Diffusion coefficient varies inversely with pressure, so a D value of 4600*10-9 m2/s at 21 bar corresponds to a D value of approximately 220*10-9 m2/s at 1 bar, showing reasonable similarity to that found in these simulations.
The liquid diffusion coefficient is of the same order of magnitude as that found in literature (2.83*10-5 cm2s-1).4 Liquids are still susceptible to change of diffusion coefficient with temperature in accordance with the Stokes-Einstein equation.5 The temperature associated with the literature value is 90 K, compared to the simulated value of 144 K. Were the pressures identical in both cases, the value of D predicted using the Einstein-Stokes equation would be . This shows good agreement with the values of 4.64 and 4.81 *10-5 cm2s-1 predicted by the MSD and VACF methods, respectively.
The solid diffusion coefficient is essentially zero due to the highly restricted freedom placed upon atoms in a high density face-centred cubic close-pack lattice.
JC: Great explanation and use of additional research and comparison with literature values. It would be good to explain briefly what system the literature results come from and how similar it is to your simulations.
References
(1) E. W. Lemmon, M. O. McLinden and D. G. Friend, in NIST Chemistry WebBook, NIST Standard Reference Database Number 69, National Institute of Standards and Technology, 1998.
(2) M. P. Allen and D. J. Tildesley, Computer simulation of liquids, Clarendon Press, 1989.
(3) S. Hi Lee, D. Kue Park and D. Bok Kang, Bull. Korean Chem. Soc. Song Hi Lee al, 2003, 24.
(4) J. Kestin, K. Knierim, E. A. Mason, B. Najafi, S. T. Ro and M. Waldman, J. Phys. Chem. Ref. Data, 1984, 13, 229–303.
(5) C. Cruickshank Miller, Math. Phys. Character, 1924, 106, 724–749.