Rep:Mod:mh3413Liquids
Molecular dynamics simulations of simple liquids
Abstract
This experiment explored the molecular dynamics of the isothermal–isobaric (N,P,T) and the canonical (N,V,T) thermodynamic ensemble in a solid, liquid and gaseous phase over time. By exploring the Lennard-Jones Potential energy surface, through the interactions of the particles, an appropriate cut-off value for the molecular simulations were able to be determined. By applying the period boundary conditions to the unit cell, the number of atoms to remained constant and the unit cells were ‘linked’. The total energy for different timesteps were used to determine a timestep value that would maximise the time of the system simulation, while also maximising the detail of the system captured. In addition, the energy timestep plots allowed the determination of the systems that had reached thermodynamic equilibrium in a appropriate number of timesteps. Using this knowledge of the LAMMPS and VMD platform, the thermodynamics properties for solid, liquid and gaseous states were successfully investigated. Physical constants such as the diffusion co-efficient were able to be approximated. This required steps of selecting physical parameters for the system eg number density, number of unit cells in the lattice, and then applying the system conditions to melt the lattice to the required temperature and state. The following sections will explain in detail the rational and steps taken for each of the calculations undertaken.
Task 2 - Velocity Verlet Algorithm
TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns "ANALYTICAL", "ERROR", and "ENERGY": "ANALYTICAL" should contain the value of the classical solution for the position at time , "ERROR" should contain the absolute difference between "ANALYTICAL" and the velocity-Verlet solution.
![]() |
![]() |
---|---|
Figure 1: The values of the classical and Verlet displacement approximation for a timestep of 0.1 | Figure 2: The total energy of the harmonic oscillator for a timestep of 0.1 |
In this section, the calculated values of particle position from the Velocity-Verlet algorithm were compared to the values of the classical harmonic oscillator. The classical harmonic oscillator position at time t was given by , where the values of and were all assumed to be equal to 1, while . Figure 1, illustrates the ideal fit of the data between the Velocity-Verlet algorithm and classical value, while figure 2 calculated the total energy of the system. The total energy of the harmonic oscillator consisted of Kinetic and Potential energies. The kinetic energy was obtained by using the equation , where mass had a value of 1 and the Velocity-Verlet algorithm values were used for the velocity. The potential energy was calculated from 1-D harmonic oscillator where the x value was the displacement from the equilibrium distance. The oscillating nature originated from the exchange of potential and kinetic energy in the system, with relatively minimal changes in the total energy.
In addition, the difference between the values of the Velocity-Verlet algorithm values for position and the classical position for the harmonic oscillator as seen above, was plotted against time in figure 3. In a similar behaviour to the displacement and the energy, the error oscillates as the error is 0 for some values of t. However, the error does not fall below 0. With increasing time, the error associated with the Velocity-Verlet algorithm values relative to the classical harmonic oscillator increased in value. The equation for the approximated linear relationship between the maxima's of the errors with time can been seen in figure 4.
Experimenting with different values of timesteps to calculate the total energy (figures 5-7) and the total error (figures 8-10), it was found that the error of the maxima (ie the amplitude of the oscillations) increased with an increasing value in the timestep. There was a linear relationship between the maxima's of the errors with respect to time. At the timestep of 0.25, the fluctuation of the error was observed to be approx 1.6%. At a timestep value of 0.05, the fluctuations in the total energy for the system did not change to 3dp, while still maintaining the oscillation nature of the system. Through a trial and error method, a suitable timestep to ensure that the total energy does not change by more than 1% was found to be t=0.20. Any timestep value less than t=0.2 would be suitable for the purposes of the calculations. However, the shorter timestep would result in a shorter simulation of the system. This could be compensated by increasing the number of runs for the system, but this would require greater computational power.
The total energy is a strong indicator as to whether the system is at thermodynamic equilibrium. If the total energy has not equilibrated, then the other physical properties observed would likely be different to the ones observed at thermodynamic equilibrium.
Lennard-Jones Potential
The Lennard-Jones Potential describes the potential of a system as two atoms or molecules approach one another from a large distance. The weak interactions between the particle species, of both repulsive and attractive forces will lead to the formation of an equilibrium distance, where the potential energy is minimised in a potential well. The repulsive component of is significant at short distances, where the term would be dominant. The attractive component of is dominant at large distances, and this is seen in the graph of the Lennard-Jones Potential as U tends towards 0 at very large values of r. [1][2]
TASK: Find the separation, , at which the potential energy is zero
When
SOLUTION: OR
Therefore there are two solution to where the Lennard-Jones potential is U=0. At a value of r=infinity, the Lennard-Jones Potential will tend towards the U=0 value.
TASK: What is the force at this separation?
As
As as
SOLUTION
TASK: Find the equilibrium separation,
Let to find the stationary point (ie minimum) in the Lennard-Jones Potential.
When
Then:
SOLUTION: This is the value of the potential minimum in the Lennard-Jones Potential
TASK: Evaluate the integrals , , and when .
The integral of the Lennard-Jones Potential corresponds to the the total interaction between the two species. As the lower limit approaches greater values of r, the total integral value tends to 0, as the Lennard-Jones Potential tends to infinity for larger values of r. In addition, the area of curve would be negative as the curve approaches 0 from the negative y values.
when
SOLUTION
From modification of equation 1:
SOLUTION
From modification of equation 1:
SOLUTION
Periodic Boundary Conditions
TASK: Estimate the number of water molecules in 1ml of water under standard conditions
TASK: Estimate the volume of 10000 water molecules under standard conditions
TASK: Consider an atom at position in a cubic simulation box which runs from to . In a single timestep, it moves along the vector . At what point does it end up, after the periodic boundary conditions have been applied?
Due to the boundary conditions applied
SOLUTION
Working in Reduced Units
TASK: The Lennard-Jones parameters for argon
SOLUTION
SOLUTION
SOLUTION
As the depth of the well is
SOLUTION
Equilibration - Task 3
TASK: Why do you think giving atoms random starting coordinates causes problems in simulations? Hint: what happens if two atoms happen to be generated close together?
Generating atoms in the random positions would generate errors in the simulation calculations as the atoms could be generated ontop or one another. This would cause problems in defining the properties and mass as the particle LJ potential would essentially be of infinite value (as r tends towards 0).
TASK: Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?
For the primitive unit cell with one atom per unit cell:
When for the FCC cubic lattice, which has a total of 4 atoms per unit cell.
TASK: Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?
In this example, if the FCC lattice had been defined from the previous task; as each unit cell has 4 atoms and there are a total of 1000 unit cells, the system would have had a total of 4000 atoms
Setting the properties of the atoms and Running the simulation
mass 1 1.0 pair_style lj/cut 3.0 pair_coeff * * 1.0 1.0
- The mass 1 1.0 is the code for identifying the mass of the atoms in the system. It is in the format of mass (atom type) (mass). Therefore, the atom of type 1 has a mass 1 associated with it. As there is only one atom type defined in the system, this applies to all the atoms.
- The pair_style lj/cut 3.0 is the code for defining the pairwise interactions of the atoms. The code specifies that the global cutoff for Lennard-Jones interactions is at a reduced distance of 3.0. The cutoff is required as the Lennard Jones potential tends to U=0 for as R tends to infinity. Therefore, the results for as R tends to infinity would be computationally intensive, but provide little extra value to the calculations, as seen in the integration exercise in task 2 eg the total potential or interactions.
- The pair_coeff * * 1.0 1.0 is the code for the pairwise force field coefficients in the Lennard-Jones Potential. It is in the format of pair_coeff (atom) (atom) (coefficients) (coefficients). The asterisk is the wildcard code that defines for all the types of atoms in the system. Therefore, this code describes that for all of types of atoms, there is a force field coefficient of 1.0. ie [3]
TASK: Given that we are specifying and , which integration algorithm are we going to use?
As we can specify and , it is possible to use the Verlet-algorithm for each half step in the system.
### 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
TASK: What do you think the purpose of these lines is?
timestep 0.001 run 100000
The later code would only be suitable if running one timestep value. The former code is more flexible to running simulations at different timesteps, as it also would automatically calculate the necessary number of runs that is required to be run in the line "variable n_steps equal floor(100/${timestep})", which is then called in the last line "run ${n_steps}".
Figure 11-13 present the pressure, temperature and total energy for the simulation values run at a timestep value of 0.001. This system equilibrates very quickly approximately at 0.5, as the three factors of pressure, temperature and total energy have a constant value and naturally fluctuate around this average value. It can be concluded that the equilibration time would be independent of the timesteps; however, the smaller the timesteps are, a greater level of detail is able to captured by this system. Therefore, the total average energy would be independent of the number of timesteps as long as the values used in the average are taken from when the system is at thermodynamic equilibrium.
Figure 14: Total Energy against time for different timestep values in simulation |
TASK: Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a particularly bad choice? Why?
The 0.0015 timestep would not be suitable as the total energy is significantly increasing for the system with time and thus does not reach thermodynamic equilibrium. For the 0.01 and the 0.0075 timesteps, it appears that the total energy is still decreasing with time. The 0.001 and 0.0025 timesteps have the same average energy. Out of these two timesteps that have reached thermal equilibrium, it would be most ideal to use the larger, 0.0025 timestep as the system would be observed over a larger period of time.
Task 4 - Running simulations under specific conditions
Solve these equations to determine .
Using the equations above, the following equation can be obtained:
TASK: Use the manual page to find out the importance of the three numbers 100 1000 100000. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?
The following line of code describes, the frequency and the number of timesteps that will be used to contribute to the average.
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2
The code is organised into the following format:
fix aves all ave/time Nevery Nrepeat Nfreq.......
- Nevery = the gap between the timestep values that will be used to calculate the average
- Nrepeat = the number of data point that are used to calculate the average
- Nfreq = the calculation of averages every Nfreq timestep
Therefore, for the code above, the average will be calculated every 100,000 timesteps using 1000 data inputs that are spaced every 100 timesteps. As the timestep was defined to be 0.025, the total time the system is simulated for:
Plotting the Equations of State
The following values set the NpT ensemble conditions, with constant temperatures and pressures simulated using the LAMMPS platform. This resulted in 10 simulations:
Temperature: 1.5, 1.6, 1.7, 1.8, 1.9
Pressure: 2.50, 2.60
Timestep: 0.0025 (as previously obtained for Task 2)
Figure 15: The density varying with temperature + ideal gas values | Figure 16: The density varying with temperature (experimental values with addition of error bars) |
It was found that with a increase in the temperature, the density decreased; ie expansion of the material. The observed graphical shape was consistent with a inverse relationship between these two variables. When the system is heated, the volume occupied would increase, due to the atoms taking up more space due to the increasing degrees of freedom and the total mass remaining the same. . The increase in pressure would be equivalent to increasing the density of the material (through Boyle's Law) and therefore the increase in the pressure would cause a transformation of the curve to higher density values. Superimposing the theoretical ideal gas curve to the experimental data, it was observed that the ideal gas density values are substantially higher that the computed values.
The difference in the values is due to the assumption made in the ideal gas model; the particles having no interactions between the other particles in the system and the particles having no volume (ie point particles). In this theoretical setting it would be possible to have the particles on top of one another and at higher densities. In this experiment, the repulsive component of the Lennard-Jones Potential would prevent this from occurring. The ideal gas only agrees well with experimental data in the low density systems, where the number of interactions are minimal. It is observed in Figures 15, that the difference in Lennard-Jones Potential and the theoretical ideal gas system increases with pressure due to the same argument relating to the interactions and density assumptions.
Task 5 - Calculating heat capacities using statistical physics
The simulations were calculated using the following conditions:
Density: 0.2, 0.8
Temperature: 2.0, 2.2, 2.4, 2.6, 2.8
Number of atoms 3375
The volume of the system was found by the following equation:
Figure 17: A plot of the Heat Capacity/Volume with respect to temperature |
The heat capacity is the energy required to raise the temperature of one unit mass of the substance, by one degree K.
- The trendline for the Heat Capacity was used, as it provided the best match to the data points ie .
- As the temperature of the system increased, the heat capacity of the system decreased. This occurs because the increase in temperature results in the amount of energy that the system absorbs is decreased from the increase of internal energy of the system. This is analogous to the two level system in statistical thermodynamics.[4]
- The increase in density would lead to a increase in the value of the heat capacity. As the density is defined as the mass per unit volume, the increase in density is equivalent to an increase of the mass packed into a unit cell of constant volume in the system. Furthermore, the increase in density means there is a greater number of the microstates that the system can occupy as the number of degrees of freedom of the unit cell increases - thus leading to an increase in the energy required to raise the temperature of a unit mass of the system, by 1K.
Comparing the experimental values to the ideal gas system:
as an ideal gas system has 3 translational degrees of freedom. This is consistent with the equipartition theorem which states that the each degree of freedom in system would contribute [4]
to the total internal energy of the system.
For a 1 mole system:
As
ie CONSTANT VALUE
Under the ideal gas law, the Heat Capacity is constant for the system. It is independent of the temperature.
Input Code for Calculation of Heat Capacity
### DEFINE SIMULATION BOX GEOMETRY ### variable density equal 0.2 lattice sc ${density} 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 2.6 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 fix nvt all nvt temp ${T} ${T} ${tdamp} run 10000 unfix nvt fix nve all nve reset_timestep 0 ### MEASURE SYSTEM STATE ### thermo_style custom step etotal temp atoms density variable n2 equal atoms*atoms variable energy equal etotal variable energy2 equal etotal*etotal variable temp equal temp variable temp2 equal temp*temp variable Number equal atoms variable dens equal density variable dens2 equal density*density fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2 v_dens run 100000 variable CV equal (((f_aves[2]-f_aves[1]*f_aves[1])/(f_aves[4]))*${n2}) variable avetemp equal f_aves[3] variable avedens equal f_aves[1] print "Temperature: ${avetemp}" print "Heat Capacity: ${CV}" print "Atoms: ${Number} print "Density: ${avedens}"
Radial distribution function - Task 6
Figure 18: Radial Distribution Function for the Lennard-Jones Potential at the different states of matter | Figure 19: Integral of the radial distribution function |
- The radial distribution function describes the effective density of particles relative from a reference particle; it is equivalent to the probability of finding a particles at a distance r from the reference particle. The RDF is a effective method of assessing the order in the molecule systems.
- The integral of g(r) ie the area under the RDF curves, is equal to the density of the particles.
Figure 18 illustrates the radial distribution function for the different states of the system at a given distance from a reference atom; in the solid, liquid and gas phases.
- The number of peaks for each state indicates the degree of ordering. ie the solid has the highest degree of ordering
- At the , for all the states.
- At short distances of r, the RDF=0. Below this distance, the atoms would be overlapping.
- For the liquid and gaseous states, the 1st peak corresponds to the minima of the Lennard-Jones Potential at
- As the distance r increases from the reference particle, the solid, liquid and gas states all tend towards a constant average effective density of 1 (1 is the bulk density of the system).
The solid is found to have a greater number of peaks and larger amplitudes of fluctuation, than the liquid and gas states. This is due to the fixed and highly ordered nature of the particles in the lattice structure, with short and long range ordering present due to the peaks present at short and long range. There is minimal degrees of freedom as the particles are in fixed lattice positions. In addition, the larger amplitude of the peaks which is especially clear from the peak closest to the reference particles, indicates a greater packing density than the liquid and gas systems; a larger number of particles are packed into a smaller distance (volume in 3-D). The oscillating nature of the RDF is analogous to a trigonometric function. This behaviour is observed due to the greater density of particles at certain distances from the reference particle and absent or minimal at the other distances.
For example: In the solid state system with
In a fcc lattice with 4 atoms, this corresponds to a
Nearest neighbours in a fcc lattice are at . Where a is the lattice parameter for the system. It would be expected that the first 3 peaks in Figure 18, correspond to the theoretical values of , and . These predictions are in agreement with the experimental data in Figure 18, with maxima peaks found at , and .
It was found from Figure 19, the for the solid state. This is equivalent to the area of the first three peaks for the solid state in figure 18.
For the liquid system, there were fewer peaks found in figure 18. This is due to the increase in the number of degrees of freedom, with 3 translation vectors. The liquid reaches an equilibrium density closer to the reference system, than for the solid as there is a short range order. In additional, there is a Lennard-Jones interaction present which leads to the formation of a local minima and some degree of short range ordering, as seen by the multiple peaks close to the reference atom. For the gas state, there is one obvious peak in system and the distance for the maximum effective density of particles is approximately the same as the liquid system (figure 19); the peak is of lower value than the liquid maxima. This is likely due to the random Brownian motion of the particles and the ability of the molecules in this gaseous state (to an extent the liquid phase) to freely move in the box. The lack of peaks present indicates there is no ordering present in the gaseous state. Furthermore, the peak present for the gaseous states is much broader than the solid or liquid states. This is due to the thermal motion of the atoms, which occurs at higher temperatures.
Dynamical properties and the diffusion coefficient - Task 7
TASK: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the "total" MSD) as a function of timestep. Are these as you would expect? Estimate in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.
The diffusion co-efficient was able to be established, using the relationship to the mean squared displacement (as seen below). Please find the D-coefficient values in the table below:
Figure 22: The plot of the mean squared displacement against timesteps for a million atoms |
TASK: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):
Derivation:
As is the displacement over time for the system.
is the velocity over time for the system
is the velocity of the 1-D harmonic oscillator
Furthermore,
Let and
As we can assume the values of and
As due to the the property of
SOLUTION:
Diffusion Co-efficient (unit area/time) to 3sf | MSD | MSD (Million atoms) | VCAF | VCAF (Million atoms) |
---|---|---|---|---|
Gas | 3.21 | 2.44 | 3.38 | 3.27 |
Liquid | 0.0689 | 0.0698 | 0.0697 | 0.0901 |
Solid | 5.00E-6 | 3.33E-06 | 1.89E-4 | 4.60E-5 |
The trend of the diffusion co-efficients are in agreement with what would theoretically would be expected.[5] The increase in the number of atoms did not produce a significant change in the value of D. The values were similar to the previously calculated values in the original VCAF and MSD. The largest source of the error in the VCAF would originate from the use of the trapeizum rule that approximates the area under the curve and the timestep value used. The calculation of the absolute integral would increase the reliability of the result, while decreasing the timestep value would increase the number data points of the curve.
As seen in Figure 20-22, the mean squared displacement of the particles initially follows a parabolic curve behaviour and then stabilizes to a linear relationship. The vapour presents the initial greatest curvature, followed by the liquid and gas. This due to a molecule at very small time values travelling in a straight trajectory until it collides with another molecule. Before the respective molecule undergoes its first collision, the velocity of the molecule would be constant, and therefore the (parabolic behaviour). The point at which the collisions start to occur with the other molecule/the MSD becomes a relationship occurs at time values t(solid)<t(liquid)<t(gas) for the respective states. This is due to the gas molecules on average being further apart from one another. They have to travel a greater distance to interaction and collide with other molecules. On the other hand, in the solid state the atoms are in fixed positions with co-ordination to the surrounding atoms, leading to very fast stabilisation to a linear MSD behavior.
The D(Solid) < D(Liquid) < D(Vapour). For the solid state system, the values of the diffusion coefficient are very low and thus indicates the time for a particle to diffuse through the system would be large. This would be due to atoms in the lattice system being in fixed positions. In the liquid state, there are a greater degrees of freedom, relative to the solid state ie translational degrees of freedom, which contributes to the larger diffusion coefficient. However, there are still interactions between the particles from the short range. The vapour state has the greatest value of the diffusion co-efficient due to the greatest degree of freedom for the system and ability to diffuse through the system at a faster rate due to only very weak forces interacting.
The behaviour in figure 23 can be explained by the interactions of the particles for the different states of matter. If the particles of the system did not interact with one another, then the velocity of the particles would remain constant at their starting velocities. However, due to the forces of interaction from the neighboring particles, the velocity of a reference particle changes over time.
The liquid does not have fixed lattice positions and a long range interactions. Figure 23 illustrates the diffusive, brownian motion of the particles in the liquid system and the collisions with the other neighboring particles, causing a sharp dampened oscillation at a low value of t. For the solid, the atoms are in fixed positions of the lattice structure and are packed together in high densities, as seen from the integral of g(r) in task 6. As there would be multiple forces and interactions for a given atom, the atom would seek to find the lowest minima energy point on its potential energy surface. This leads to the oscillation in the velocity well, found in figure 23 for the solid state. The perbutations and collisions with the surrounding atoms, would dampen the oscillations of the atom and decorrelate the velocity over time. The diffusive behaviour would mean that over time the energy is transferred throughout the lattice structure to increase the overall entropy of the system. The velocity of the reference atom would tend close to 0 for t infinite.
The harmonic oscillator provides a good approximation for locating the values of t, which give the minimum values in the solid and the liquid states. There are no collisions that occur in the harmonic oscillator and therefore the force constant of the oscillations will remain constant in the opposite direction of displacement. This produces the non-decaying oscillating behaviour as seen in figure 23.
Figure 23: The plot of the velocity auto correlation function for 500 timesteps in the liquid and solid states |
The greatest error is associated with the gaseous state, due to the largest curvature for the running integral in figure 24 & 25 for both the million atoms and the original simulations. This is due to the trapezium rule underestimating the value of the integral. Using smaller timesteps would help to reduce this error by producing a better trapezium approximation to the curve and thus a more accurate value of the integral. The solid state would have the lowest associated error due to the stable linear nature of the curve, leading to approximations using the MSD and the VCAF via the trapezium rule being possible and accurate.
Figure 24: The VCAF running integral approximated by the trapezium rule | Figure 25: The VCAF running integral approximated by the trapezium rule for the solid and liquid phase |
- ↑ Properties of the Lennard-Jones Potential, http://web.mit.edu/pshanth/www/8223finalproject.pdf, Accessed: January 2017.
- ↑ Lennard-Jones Potential, http://www.physics.drexel.edu/~bob/Term_Reports/Brad_Hubartt.pdf, Accessed: January 2017.
- ↑ LAMMPS Documentation, http://lammps.sandia.gov/doc/Manual.html, Accessed: January 2017.
- ↑ 4.0 4.1 Professor Fernando Bresme, Statistical Thermodynamics, Physical Chemistry, Imperial College London, November 2016.
- ↑ Phase Transitions of the Lennard-Jones System, Jean-Pierre Hansen and Loup Verlet , PHYSICAL REVIEW VOLUME 184, NUMBER 1 5 AUGUST 1969, Accessed: January 2017.