Talk:Mod:lb3714liquidsim
JC: General comments: Report is clearly laid out and most answers are very focused and concise. I think you have misunderstood or run out of time on some of the questions towards the end though, ask for help if you don't understand.
Introduction to Molecular Dynamics Simulation



Experimenting with timestep values
Timestep | ΔE (%) |
---|---|
0.001 | 0.000 |
0.010 | 0.001 |
0.050 | 0.031 |
0.100 | 0.125 |
0.150 | 0.281 |
0.200 | 0.500 |
0.250 | 0.781 |
0.300 | 1.125 |
0.500 | 3.125 |
1.000 | 9.375 |

The table above shows that a timestep of approximately 0.25 or less is needed to ensure the total energy does not change by more than 1% over the course of the simulation. It is important to monitor total energy throughout a simulation because energy is conserved; that is, total energy is constant.[1] If it changes significantly during the course of a simulation, the simulation will not accurately reflect reality.
Atomic Forces
Lennard-Jones potential
When the potential energy is zero, .
At equilibrium, the force, is zero, so the minimum must be found.
Well depth at :
Evaluating integrals when :
, therefore:
JC: All maths correct except the equilibrium value of r, check the last line of your working - it should be 2^(1/6)*sigma, although the numerical value is correct.
Periodic Boundary Conditions
Number of water molecules in 1 mL of water under standard conditions:
Volume of 10,000 water molecules:
If an atom at position moves along the vector , after the periodic boundary conditions have been applied it would end up at the position .
JC: Correct.
Reduced Units
,
JC: Correct.
Equilibriation
Creating the Simulation Box
Giving atoms random starting coordinates and subsequently generating two atoms close together could cause the atoms to merge into each other.
In a simple cubic lattice, there is 1 atom. If the lattice spacing is 1.07722:
In a face-centred cubic lattice, there are 4 atoms. If the density is 1.2, the lattice spacing is approximately 1.4938:
If a face-centred cubic lattice had been defined instead, 4000 atoms would have been created, since such a lattice contains 4 atoms.
JC: Correct.
Setting the properties of the atoms
Script | Definition |
---|---|
mass 1 1.0 |
Sets the mass for all atoms of one or more atom types. The first number corresponds to atom type, which is arbitary; the second number corresponds to the mass of the type. |
pair_style lj/cut 3.0 |
Sets the formulae LAMMPS uses to compute pairwise interactions. Here, lj corresponds to the style, and cut 3.0 corresponds to the arguments used by that style. |
pair_coeff * * 1.0 1.0 |
Specifies the pairwise force field coefficients for one or more pairs of atom types. The asterisks represent atom types, and 1.0 1.0 (arguments) represent the coefficients for the pairs, which depend on the pair style. |
JC: What are the coefficients for the Lennard-Jones system that we are simulating here?
Since we are specifying and , we are using the Velocity Verlet Algorithm.
Running the Simulation
### SPECIFY TIMESTEP ### variable timestep equal 0.001 variable n_steps equal floor(100/${timestep}) variable n_steps equal floor(100/0.001) timestep ${timestep} timestep 0.001 ### RUN SIMULATION ### run ${n_steps} run 100000
The purpose of n_steps is to simulate how much time to run (100) and to divide it into timesteps. Simply writing
timestep 0.001 run 100000
indicates the number of timesteps to run, but not actually the amount of time.
JC: Not quite, both pieces of code will do the same thing - run a simulation with timestep = 0.001 for 100000 steps. The advantage of using variables is that if we change the value of the timestep, the number of steps to run changes automatically to ensure the simulation is the same length. In the second case this would have to be changes manually.
Checking Equilibriation



The simulation reaches pressure equilibrium after approximately 0.2 seconds, and energy and temperature equilibrium after approximately 0.3 seconds.

The largest timestep to use that gives acceptable results is 0.0025. At timesteps above this, the values for energy, temperature and pressure begin to diverge (which may yield inaccurate values), whereas values for 0.001 and 0.0025 are very similar. Conversely, 0.015 is a particularly bad timestep to use because it does not equilibriate within the time specified.
JC: Good choice. Refer to the figures by number in the text.
Running Simulations Under Specific Conditions
Examining the Input Script
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2
fix ave/time, the command on this line of script, takes one or more input values every few timesteps and averages them over longer timescales. The general fix ave/time command takes the following form:
fix ID group-ID ave/time Nevery Nrepeat Nfreq value1 value2 ... keyword args ...
In this simulation:
- Nevery = 100, meaning that input values are sampled every 100 timesteps.
- Nrepeat = 1000, meaning that input values are used to calculate averages 1000 times over the course of the simulation.
- Nfreq = 100000, meaning that averages are calculated every 100000 timesteps.
100000 timesteps will be simulated.
Chosen Conditions
Conditions were chosen by looking at the average values gained in the previous simulations. A timestep of 0.0025 was used.
Temperatures:
- 2.50
- 3.00
- 3.50
- 4.00
- 5.00
Pressures:

The following pressures were selected because the previous simulations showed an average pressure of about 2.5.
- 2.00
- 3.00
Thermostats and Barostats
The value of calculated so that the temperature is correct if we multiply every velocity by was calculated as follows:
Since :
JC: Correct and clear derivation.
Results and Discussion



The figures on the right show that for both pressures, density decreases with temperature. At all temperatures, density was higher at a pressure of 3 than 2. Predicted density was calculated from the following variant of the ideal gas law:
Where , the Boltzmann constant, was assumed to = 1 as is standard in LAMMPS.
The density trends calculated using the ideal gas law were significantly higher than the relevant simulated trends. This is because the ideal gas law calculates density using bulk volume, which does not take voids into account and so assumes a 100% packing efficiency. In the simulation, the initial structure of the crystal was a simple cubic lattice, which has a packing efficiency of about 52%. This is further evidenced by the ratio between the simulated and calculated densities at a pressure of 3 and temperature of 2.5:
However, the discrepancy between simulated and calculated densities decreased with pressure.
JC: There are no interactions between particles in an ideal gas and no excluded volume around particles, unlike in the simulation in which repulsion between particles forces them further apart and decreases the density. Don't connect the data points in the graph with straight lines as this is misleading since the relationship between temperature and density is not linear between data points.
Calculating Heat Capacities using Statistical Physics

Example script
### DEFINE SIMULATION BOX GEOMETRY ### variable dens equal 0.2 lattice sc ${dens} region box block 0 15 0 15 0 15 create_box 1 box create_atoms 1 box ### DEFINE PHYSICAL PROPERTIES OF ATOMS ### mass 1 1.0 pair_style lj/cut/opt 3.0 pair_coeff 1 1 1.0 1.0 neighbor 2.0 bin ### SPECIFY THE REQUIRED THERMODYNAMIC STATE ### variable T equal 2.0 variable p equal 1.0 variable timestep equal 0.0025 ### ASSIGN ATOMIC VELOCITIES ### velocity all create ${T} 12345 dist gaussian rot yes mom yes ### SPECIFY ENSEMBLE ### timestep ${timestep} fix nve all nve ### THERMODYNAMIC OUTPUT CONTROL ### thermo_style custom time etotal temp press thermo 10 ### RECORD TRAJECTORY ### dump traj all custom 1000 output-1 id x y z ### SPECIFY TIMESTEP ### ### RUN SIMULATION TO MELT CRYSTAL ### run 10000 unfix nve reset_timestep 0 ### BRING SYSTEM TO REQUIRED STATE ### variable tdamp equal ${timestep}*100 variable pdamp equal ${timestep}*1000 fix nvt all nvt temp ${T} ${T} ${tdamp} run 10000 reset_timestep 0 unfix nvt fix nve all nve ### MEASURE SYSTEM STATE ### thermo_style custom step etotal temp press density atoms vol variable n equal atoms variable etotal equal etotal variable etotal2 equal etotal*etotal variable dens equal density variable dens2 equal density*density variable temp equal temp variable temp2 equal temp*temp variable press equal press variable press2 equal press*press variable vol equal vol fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2 v_etotal v_etotal2 run 100000 variable avedens equal f_aves[1] variable avetemp equal f_aves[2] variable avepress equal f_aves[3] variable errdens equal sqrt(f_aves[4]-f_aves[1]*f_aves[1]) variable errtemp equal sqrt(f_aves[5]-f_aves[2]*f_aves[2]) variable errpress equal sqrt(f_aves[6]-f_aves[3]*f_aves[3]) variable heatcap equal ${n}*${n}*(f_aves[8]-f_aves[7])/f_aves[5] print "Averages" print "--------" print "Volume: ${vol}" print "Heat capacity: ${heatcap}" print "Density: ${avedens}" print "Stderr: ${errdens}" print "Temperature: ${avetemp}" print "Stderr: ${errtemp}"
Results and discussion
The heat capacity for a density of 0.8 was greater than that for 0.2 at all temperatures. The heat capacity at a density of 0.8 plateaued at temperature ranges of 2.2-2.4 and 2.4-2.6; this could correspond to phase transitions. The trend established is not the one expected; theoretically the heat capacity should be expected to increase with temperature[2], but the established trend shows a decrease in with temperature. Also,higher densities should correspond to lower specific heat capacities; this is because at a higher density, the amount of heat a structure can intake is smaller.
The input script indicates that once the correct thermodynamic conditions have been established, the canonical ensemble NVT should be unfixed and the microcanonical ensemble NVE should be fixed. NVE assumes that energy E is constant; however, the calculation for heat capacity requires that the energy vary. Therefore, the discrepency between the theoretical trend between heat capacity and temperature, and the simulated trend, may be because during the simulation the total energy was taken to be constant, and so heat capacity and temperature were directly inverse to one another. In theory, the total energy should increase with temperature.
JC: At higher densities Cv should be greater as the system contains more atoms and so needs more energy to raise the temperature. The decrease in heat capacity with temperature is related to the density of states, however, this is beyond the scope of this experiment.
Structural Properties and the Radial Distribution Function
The radial distribution function g(r) describes how density varies as a function of distance from a reference particle. It describes how, on average the atoms in a system are radially packed around each other, allowing the average structure to be determined. RDF is usually plotted as a function of r, the interatomic separation.
Chosen conditions for simulation
Solid | Liquid | Vapour | |
---|---|---|---|
Density | 1.20 | 0.80 | 0.05 |
Temperature | 1.20 | 1.20 | 1.20 |
Results and discussion

The peaks in a radial distribution function represent probabilities that atoms lie at the location specified by r. The g(r) for the gas phase shows a peak when 1<r<2, but there is no significant oscillation at longer distances. The liquid g(r) shows some weak oscillation up to an rof 4. The solid g(r) shows strong oscillation peaks even at longer distances. This indicates the presence of long-range order consistent with a crystalline structure. In contrast, the gas g(r) shows only short-range order consistent with a highly disordered structure.
The crystal structure of the solid is a face-centred cubic lattice. The first peak in the radial distribution function corresponds to
JC: Some of this question is missing. Did you calculate the lattice parameter or plot the integral of g(r)?
Dynamical Properties and the Diffusion Coefficient
Mean Squared Displacement





The conditions specified for each phase were the same ones for the previous section. D, the diffusion coefficient, was calculated from the gradient of each plot using the following equation:
N = 800:
Solid | Liquid | Vapour | |
---|---|---|---|
Slope | |||
D |
N = 1 million:
Solid | Liquid | Vapour | |
---|---|---|---|
Slope | |||
D |
The mean squared displacement measures how far a particle deviates from a reference position over time. Figures 15 and 16, as well as the above tables, show that the gradient of the mean squared displacement over time increases in the ascending order of solid, liquid and vapour. This is expected because the solid is highly dense and so its atoms cannot diffuse far from the reference point; indeed, the gradient for the solid mean squared displacement is approximately zero. In contrast, the plot for the vapour (Figure 19) phase has a much higher gradient once a linear relationship is established after approximately 20000 timesteps. The vapour phase is not particularly dense and so its atoms are able to diffuse much further from the reference point much more rapidly.
JC: It would have been good to show your linear fits in the graphs of the solif, liquid and gas MSDs.
Velocity Autocorrelation Function
Evaluating the integral:
Earlier the values for and were given:
- =1.00
- =0.00
Therefore .

JC: You should have worked out an analytical expression for C(tau) which is cos(omega*tau).
The velocity autocorrelation function indicates the difference in velocities of an atom will be between time and ; essentially how the velocity of the atom changes over time. A plot of the velocity autocorrelation function shows oscillation peaks corresponding to vibrations that weaken over time, indicating that interatomic forces are decaying the velocity. The minima represent a temporary lack of change in velocity as the atom slows down and speeds back up again.[3] The plot for the solid shows more oscillation peaks than that for the liquid. This is because the intermolecular forces in a solid are much stronger and therefore have a larger effect on the velocity. The are therefore in good agreement with theory.
JC: Did you calculate the running average of the VACF? The decay in the VACF is due to motion becoming uncorrelated over time due to collisions between particles.
References
- ↑ Atkins, P. and De Paula, J., 2014. Atkins’ Physical Chemistry. New York, pp.12.
- ↑ Ginnings, D.C. and Furukawa, G.T., 1953. Heat Capacity Standards for the Range 14 to 1200° K. Journal of the American Chemical Society, 75(3), pp.522-52
- ↑ Alder, B.J. and Wainwright, T.E., 1970. Decay of the velocity autocorrelation function. Physical review A, 1(1), p.18