Rep:Modxl9814
Theory
Velocity Verlet Algorithm
One way to solve Newton's Second law F=ma is the velocity-Verlet algorithm. By using a Taylor expansion,the atomic positions, velocities and accelerations can be approximated at time t with good precision. The position of atom i, at time t, is denoted by and the velocity of the atom at time t is denoted by . Position at the next timestep can be expressed by:
A single timestep is expressed as:
The classical harmonic oscillator can be describe by . The errors oscillate through 5 peaks in the simulated time. The plot of the total energy vs. time of the simulated system:
The cumulative error over a constant interval of time is given by:
Thus, it can be seen from this equation that the relation between the maxima of the error of the Velocity-Verlet algorithm and is quadratically increasing. The graph of the maxima of error vs. time therefore can be fit into the quadratic equation in figure 2.
The total energy of the oscillating system is the sum of the kinetic energy and the potential energy, with and . In this case, m=1 and k=1, therefore the equation is .
In order for the total energy not to change by more than 1% over the course of the simulation, the timestep needs to be 0.2. It is important to monitor the total energy of the system to ensure that energy conservation is obeyed, the same as the real system.
Periodic Boundary Conditions
. The density of water= under standard consitions (298K, 1atm). So the total mass of 1 mL water= 1g. The number of moles of water molecules=
Therefore the total number of molecules in 1 mL of water=
The volume of 10,000 molecules of water=
Equilibration
Creating the simulation box
Giving atoms random starting coordinates may make two atoms generated too close together. This will cause the two atoms to collide and arise the repulsion between the two atoms. The repulsive force between the atoms will drive them apart, leading to increase in the potential energy of the system and making it very unstable.
A face-centered cubic lattice has 4 lattice points per unit cell. The side length of the cubic unit cell=
If 1000 unit cells were generated by the create_atoms command, 4000 atoms would be generated for a FCC lattice.
Setting the properties of the atoms
Mass 1 1.0
This means the mass of the single type of atom is 1.0.
Pair_style lj/cut 3.0
"Pair_style" indicates that the interaction is pairwise interaction. "lj.cut" describes the standard 12/6 Lennard-Jones potential without a Coulombic pairwise interaction. "3.0" indicates that the global cutoff for atoms is at 3.0.
Pair_coeff * *1.0 1.0
"pair_coeff" specifies the pairwise force field coefficients. The two asterisks indicate that the command will apply to all atoms.
If and are specified,the Velocity-Verlet algorithm will be used for this simulation.
Running the simulation
The purpose of defining variable is that we don't need to manually change the numerical timestep each time the timestep needs to be changed. This reduces the human errors that may occur as the timestep only needs to be changed once to the value defined.
Checking equilibration
The simulation reaches equilibrium at 0.001 timestep as pressure and temperature become constant. It can be seen from pressure and temperature data that the simulation reaches equilibrium at t=0.29.The average pressure value is about 2.61 and the average temperature value is about 1.26.
It can be seen from Fig 5 that the total energy produced by 0.0025 timestep are very close to those produced by 0.001 timestep. Simulations at 0.0075 and 0.01 also reach equilibrium but the total energies are higher than those produced by 0.001 timestep, thus these timesteps are not very accurate. Therefore the largest timestep to get acceptable results is 0.0025 and the worst choice is 0.015 timestep as the simulation doesn't reach equilibrium.
Running simulations under specific conditions
Examining the Input Script
The numbers 100 1000 100000 indicate the timesteps the input values will be used to compute the averages of density, pressure and temperature. For this simulation, the average will be calculated using values produced by timestep 100,200,...100000. Therefore, 1000 values will be used to calculate the average. The following line tells LAMMPS to run the simulation for 100000 timesteps. 0.0025 timestep will be used. Therefore 250 time units are simulated.
Plotting the Equations of State
Simulations were conducted at temperatures 2,2.5,3,3.5,5 and pressures 2.3 and 2.6.
Heat Capacity Calculation
In the NVT ensemble, pressures (0.2,0.8) and temperatures (2,2.2,2.4,2.6,2.8) were used to calculate the heat capacity by using the following equation:
The code to run the simulation in the NVT ensemble is as following:
variable density equal 0.2 ### DEFINE SIMULATION BOX GEOMETRY ### 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 4 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 ### MEASURE SYSTEM STATE ### thermo_style custom step etotal temp press atoms density vol variable dens equal density variable dens2 equal density*density variable temp equal temp variable volume equal vol variable temp2 equal temp*temp variable press equal press variable press2 equal press*press variable N2 equal atoms*atoms variable E2 equal etotal*etotal variable E equal etotal fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2 v_E v_E2 unfix nvt fix nve all nve 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 heatcapacity equal ${N2}*(f_aves[8]-f_aves[7]*f_aves[7])/f_aves[5] variable CV equal ${heatcapacity}/${volume} print "Averages" print "--------" print "Density: ${avedens}" print "Stderr: ${errdens}" print "Temperature: ${avetemp}" print "Stderr: ${errtemp}" print "Pressure: ${avepress}" print "Stderr: ${errpress}" print "heatcapacity: ${heatcapacity}" print "volume: ${volume}" print "heatcapacity/volume: ${CV}"
Structural properties and the radial distribution function
The radial distribution function was plotted for vapour, liquid and solid phases(Fig.9). The densities and temperatures were chosen from the phase diagram for the Lennard-Jones diagram.[2]:
Phase | Density | Temperature |
---|---|---|
Vapour | 0.1 | 1.2 |
Liquid | 0.8 | 1.2 |
Solid | 1.6 | 1.2 |
Dynamical properties and the diffusion coefficient
Mean Squared Displacement
The mean squared displacement is given by:
For 3375 atoms:
For 1 million atoms:
The diffusion coefficient is given by:
is the slope of the trendline of the mean squared displacement vs. timestep plot. The timestep .
Velocity Autocorrelation Function
The equation of the position of a 1D harmonic oscillator is:
, thus:
and
Therefore, by substitution:
Since :
Since :
As is an odd function, the area above the x-axis and below the x-axis cancel out from negative infinity to positive infinity. Thus, . therefore:
The minima in the VACF for the liquid system represent the collisions between the atoms and the solvent molecules and change in direction. The minima in the VACF for the solid system represent the collisions between the atoms and change in direction. The minima for the solid system is lower than the minima for the liquid system because of the stronger interatomic forces. The VACF for the liquid system only has one weak oscillation, this is because the atoms only interact with their closest neighbor. In the VACF for the solid system, there are more oscillations as the atoms can vibrate in fixed positions. The harmonic oscillator VACF is very different to the Lennard Jones liquid and solid as there are no interactions between the atoms so the atoms will always vibrate with constant velocity without loss in energy. Therefore, the amplitude doe not change.
By applying the trapezium rule, integral under VACF can be calculated and running integral can be plotted:
For 3375 atoms:
For 1 million atoms:
The diffusion coefficient is calculated by:
The last point of the running integral is .
For 3375 atoms: Liquid: ; Solid: ; Gas: ;
For 1 million atoms: Liquid: ; Solid: ; Gas: .
The diffusion coefficient calculated from this method was largest for gas, followed by liquid and then gas. The coefficients for the larger system were very similar to the ones for the smaller system. The coefficients calculated by MSD were similar to the ones calculated by VACF for liquid and gas, but the coefficient calculated by VACF was larger than the one calculated by MSD for solid. The largest source of error may be that the trapezium rule overestimates the area under the solid curve as the timestep is not small enough.