Rep:Mod:ym28142814
Theory
Velocity Verlet Algorithm
The velocity-Verlet solution for the position at time t is calculated by the equation below where timestep is 0.1:
The position of a classical harmonic oscillator is calculatd by . In this case, =1.00, =0.00 and =1.00.

The plot above shows a comparison between the classical solution and velocity-Verlet solution and it can be seen that there are no significant differences between two solutions.
The graph below shows the actual difference between the two solutions.

The maxima in error are estimated and shown as a function of time (brown line), which can be fit to the equation shown in the graph. The total energy of the oscillator is the sum of kinetic and potential energies: , where and are the velocity-Verlet solution for velocity and position (=1.00 and =1.00).


In order to make sure the total energy does not change by more than 1%, timestep should be no more than 0.2. In a simple harmonic oscillator, the sum of kinetic energy and potential energy should ideally be constant, so it is important to monitor the total energy of a physical system when modeling its behaviour numerically.
Atomic Forces
For a single Lennard-Jones interaction, the potential energy can be calculated by . When the potential energy is zero, the separation is equal to the value of ( = =).
The force acting on an object is determined by the potential that it experiences:
So the force at this seperation can be calculated as below:
Since = =,
Therefore the force at can be simplified to :
The equilibrium separation can be found when the force is equal to zero:
Since , the well depth can be calculated as following:
Since , can be simplyfied as below:
when ,
Periodic Boundary Conditions
Mass of one water molecule can be calculated as:
Since and the density of water is under standard consitions, the volume of 10000 water molecule can be estimated as below:
In a single timestep, an atom at position moves along the vector , the final position is . After applying periodic boundary conditions, the final position is .
Reduced Units
Since , in real unit can be calculated as:
Since , the well depth in can be calculated as:
Since , the reduced temperature in real units can be calculated as:
Output of First Simulations
Creating the simulation box
Generating random starting coordinates for atoms causes problems in simulations because if two atoms happen to be generated close together, the force between two will be large and the resulting potential energy will be high as well, which makes the system unstable. Therefore the final results of simulation will be inaccurate.
In the output file, a simple cubic lattice is created and the distance between the points of this lattice is 1.07722 (in reduced units).
In the case of fcc cubic lattice, the number of lattice points is 4. Since the lattice point number density is 1.2 in this case, the side length can be calculated:
1000 unit cells will be created by the create_atoms command and therefore 4000 atoms will be created for the fcc cubic lattice.
Setting the properties of the atoms
mass 1 1.0 pair_style lj/cut 3.0 pair_coeff * * 1.0 1.0
There is only one atom type and the mass is 1.0.
The pairwise interaction is set as cutoff Lennard-Jones potential with no Coulomb and the cutoff for atoms is at 3.0.
pair_coeff specifies the pairwise force field coefficients for one or more pairs of atom types and the asterisks mean all atom types.
and are being specified, so velocity Verlet Algorithm will be used.
Running the simulation
It will be better to replace the text string with a value needed rather than define it directly.
Checking equilibration
![]() |
![]() |
![]() |
The simulation reaches equilibrium at about t=0.3 and the total energy at equilibrium is about -3.18(in reduced unit).
The pressure and temperature of the system also reach a constant average value with fluctuations, which is 2.6 and 1.3 respectively.

Of the five timesteps used, 0.0025 is the largest to give acceptable results. It gives the most similar results as 0.001 timestep. 0.015 is a particularly bad choice because the simulation does not reach an equilibrium and the total energy keeps increasing.
Temperature and Pressure Control
Thermostats and Barostats
In our system with atoms each with 3 degrees of freedom:
In order to get our target temperature , every velocity can be multiplied by a constant factor :
This equation can be simplified as below:
Examining the Input Script
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2 run 100000
The Nevery, Nrepeat, and Nfreq arguments (100, 1000, 10000 in this case) specify on what timesteps the input values will be used in order to contribute to the average. The final averaged quantities are generated on timesteps that are a multiple of Nfreq. The average is over Nrepeat quantities, computed in the preceding portion of the simulation every Nevery timesteps.
The values will be sampled for the average every 100 timesteps and there are 1000 measurements contribute to the average.Then values on timesteps 100, 200, ... 100000 will be used to compute the final average on timestep 100000.
The timestep is 0.0025 and the simulation is run over 100000 timesteps, so the total time of simulation should be 250.
Plotting the Equations of State
10 simulations was run at 5 different temperatures (T=2.0, 3.0, 4.0, 5.0, 6.0) and 2 different pressures (P=2.6, 3.0) at 0.0025 timestep as it shows the best results in last section.
The ideal gas law shows , which can be used to calculate density as the equation showing below:
Since all variables are in reduced units after simulation and , , [1], the density predicted by ideal gas law can be calculated as below:
From the graph, it can be seen that the simulated density is lower than the ideal density and the discrepancy increases as pressure increases and it decreases as temperature increases.
Calculating heat capacities using statistical physics
The heat capacity of the system can be calculated by the equation showing below:
In this case, the temperatures and densities used are 2.0,2.2,2.4,2.6,2.8 and 0.2, 0.8 respectively.
One of the input scripts is shown below:
variable dens equal 0.2 ### DEFINE SIMULATION BOX GEOMETRY ### 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 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 reset_timestep 0 ### MEASURE SYSTEM STATE ### thermo_style custom step etotal temp vol atoms variable volume equal vol variable atoms2 equal atoms*atoms variable temp equal temp variable temp2 equal temp*temp variable E equal etotal variable E2 equal etotal*etotal fix aves all ave/time 100 1000 100000 v_temp v_temp2 v_volume v_E v_E2 unfix nvt fix nve all nve run 100000 variable avetemp equal f_aves[1] variable heatcapacity equal ${atoms2}*(f_aves[5]-f_aves[4]*f_aves[4])/f_aves[2] variable heatcapacityV equal ${heatcapacity}/${volume} print "Averages" print "--------" print "Temperature: ${avetemp}" print "Heat Capacity: ${heatcapacity}" print "Heat Capacity over V: ${heatcapacityV}"
In order to make the heat capacity independent of the size, we plot against temperature.
According to the equation, the temperature and heat capacity are inversely proportional. So the value of should decrease with temperature.
As for a larger density system, it will have more atoms at a fixed volume and the ability of it to store internal energy will be stronger, therefore the value of at will be higher than at.
Structural properties and the radial distribution function
An atomic trajectory is recorded to generate RDFs for the solid, liquid, and vapour phase Lennard Jones systems. In order to get 3 different phases, the density and temperature is modified as below [2]:
vapour | liquid | solid | |
---|---|---|---|
Temperature | 1.15 | 1.2 | 1.15 |
Density | 0.05 | 0.8 | 1.5 |
The RDF[1] defines the probability of finding a particle at a distance r from another particle. For all 3 systems, when r is small, the value of g(r) is zero as two particles can not occupy the same space due to repulsion forces and the first coordination sphere is found when .
Gases do not have a regular structure and only have one coordination sphere that will rapidly decay to normal density, g(r)=1.
Solids have regular and specific structure over a long range. The peaks indicate the coordination shells for the solid. The first peak represents the nearest neighbours, the second peaks is for the second nearest neighbours and so on. There is no possibility to find particles in between as all molecules are regularly packed.
Liquids are more loosely packed than solids, therefore, do not have exact intervals.
Acoording to the plot above, as for solid, the coordination number of the first coordination shell is 12. And the coordination number for the second and third shell is 6 and 24 respectively.
Dynamical properties and the diffusion coefficient
Mean Squared Displacement
The densities and temperatures used are the same as last section. The graphs below show the simulation of MSD of liquid, solid and gas as well as for a 1 million atoms system.
The graphs vapour and liquid for both small and large scales are nearly the same. The graph for solid at a small scale looks similar to the larger system one but with more fluctuations because the stability of a system containing 1 million atoms would be much higher.
Solid shows a completely different shape due to its regular structure and it has a fixed position for each atom (with vibrations).
The value of D can be estimated by the equation showing below:
In this case, =gradient of trend line /timestep.
As for small systems,
vapour:
liquid:
solid:
As for larger systems,
vapour:
liquid:
solid:
Velocity Autocorrelation Function
The equation for the evolution of the position of a 1D harmonic oscillator as a function of time is shown below:
Since ,
Acoording to the trigonometric formula :
Since ,
Sine function is an odd function, which means the integral of it from to will be zero. Therefore the second part of the equation shown above should also be zero.
Then the equation can be simplified to:
The graph below shows the difference between VACFs of Lennard Jones liquid and solid and harmonic oscillator VACF.
The velocity of a molecule after the collision will be independent of its initial velocity[3]. Both magnitude and direction are expected to change with the influence of the force. The minimum value on the graph corresponds to the largest difference between final velocity and initial velocity. Solid has a lower value than the liquid due to stronger interatomic force. In the case of harmonic oscillator, the interatomic force is not involved.
The following equation can be used to calculate D:
Trapezium rule is then used to estimate the integrals under VACFs for gas, liquid and solid and the plots of running integral are shown below:
As for larger systems:
Calculations for values of D for small systems:
gas:
liquid:
solid:
As for larger systems:
gas:
liquid:
solid:
The values of D obtained are very close to the values from the last section except for the value of solid.
The trapezium rule is not that accurate especially for solid and it can be improved by smaller timestep.
References
- ↑ S. Delage Santacreu ,G. Galliero, M. Odunlami and C. Boned, "Low density shear viscosity of Lennard-Jones chains of variable rigidities", J. Chem. Phys., 137, 204306(2012). DOI:10.1063/1.4767528
- ↑ Jean-Pierre Hansen and Loup Verlet, "Phase Transitions of the Lennard-Jones System", Phys. Rev., 184, 151, 1969.DOI:10.1103/PhysRev.184.151
- ↑ Otto J. Eder, "The velocity autocorrelation function and the diffusion coefficient for a dilute hard sphere gas", J. Chem. Phys., 66, 3866 (1977).DOI:10.1063/1.434461