Jump to content

Rep:Mod:Kcl14

From ChemWiki

Introduction to molecular dynamics simulation

Velocity Verlet Algorithm

'Analytical' is given by x(t)=Acos(wt+ϕ).

'Energy' is given by the summation of the potential energy, 12kx2, and kinetic energy, 12mv2, for a harmonic oscillator.

'Error' is given by the absolute difference between the 'Analytical' value and Velocity-Verlet value.

Time step = 0.1
Time step = 0.1
Time step = 0.1

The value of R2=1 obtained from a linear fit of the error maxima suggests a strong linear correlation.

The fluctuations in energy for timesteps, 0.1, 0.05 and 0.2, were then calculated as a percentage of the lowest value observed and plotted against time.

Time step = 0.1
Time step = 0.05
Time step = 0.2

At time step = 0.2, the fluctuation in the energy values during the simulation does not exceed 1%. It is important to ensure the total energy fluctuations of a system are not significant enough to introduce large errors into the simulation of its thermodynamic properties.

Atomic Forces - Lennard Jones Potential

ϕ(r)=4ϵ(σ12r12σ6r6)

Potential energy is zero when ϕ(r)=0,

0=4ϵ(σ12r12σ6r6)
σ6r6=σ12r12
r6=σ6
r0=σ

The force at r0 can be obtained with the relationship where F=ϕ(r)dr ,

ϕ(r)dr=4ϵ(12σ12r13+6σ6r7)
F=ϕ(r)dr=4ϵ(12σ12r13+6σ6r7)

Substituting r0=σ,

F=ϕ(r)dr=4ϵ(12r+6r)
F=24ϵσ

The equilibrium separation can be found by obtaining the minimum of the Lennard Jones Interaction where ϕ(r)dr=0,

ϕ(r)=4ϵ(σ12r12σ6r6)
ϕ(r)dr=4ϵ(12σ12r13+6σ6r7)
0=4ϵ(12σ12r13+6σ6r7)
12σ12r13=6σ6r7
6r6=12σ6
req=216σ


The well depth is then calculated with a substitution of req=216σ,

ϕ(req)=4ϵ(σ12r12σ6r6)

ϕ(req)=4ϵ(σ124σ12σ62σ6)

ϕ(req)=4ϵ(σ124σ12σ62σ6)

ϕ(req)=4ϵ(1412)

ϕ(req)=4ϵ(14)

ϕ(req)=ϵ


For σ=ϵ=1.0,

2σ4ϵ(σ12r12σ6r6)dr
=4ϵ[111σ12r11+15σ6r5]2σ
=0.0248


2.5σ4ϵ(σ12r12σ6r6)dr
=4ϵ[111σ12r11+15σ6r5]2.5σ
=0.00818


3σ4ϵ(σ12r12σ6r6)dr
=4ϵ[111σ12r11+15σ6r5]3σ
=0.00329

Volume of Water Molecules

The number of water molecules can be calculated from the number of moles of water in 1 ml (assuming a density of 1 g per ml) multiplied by Avogadro's number.

Numberofwatermoleculesin1ml=118(6.02×1023)=3.34×1022molecules

The volume of water molecules can be calculated from the number of water molecules multiplied by the volume of one molecule which can be obtained from the previous calculation.

Estimatedvolumeof10000watermolecules=100003.34×1022×106m3=2.99×1025m3

Cubic Simulation Box

Newposition=1.2i+1.1j+0.7k

After accounting for the periodic boundary conditions and since the box runs for one unit length in each direction, the particle reappears from the opposite side of the box at coordinates shown below.

Newpositionwithperiodicboundaryconditions=0.2i+0.1j+0.7k

Reduced Units

LJ cutoff in real units

r*=rσ

3.2=r0.34×109

r=1.088×109m

r=1.088nm

Reduced Temperature

T*=KBTϵ

T=120×1.5

=180K

Well Depth

ϵKB=120

ϵ=120×1.38×1023

=1.656×1021J

=0.997kJmol1

Equilibration

Simulation Box

Giving the atoms random initial coordinates gives rise to the possibility where the atoms are generated really close to each other. This can lead to large repulsive interactions that would not normally occur under realistic conditions.



VolumeofSimpleCubicUnitCell=1.0773=1.25

And since there is 1 lattice point per unit cell,

NumberDensityofLatticePoints=11.25=0.8

For the face-centred cubic (FCC) lattice,

4x3=1.2

VolumeofCubicUnitCell=x3=3.33

x=1.494

SideLengthofCubicUnitCell=1.494

For a FCC lattice, since there are 1000 unit cells generated and there are 4 lattice points per unit cell, there will be 4000 lattice points in the box. This corresponds to 4000 atoms.

Setting the Properties of the Atoms [1]

"mass 1 1.0" sets the mass of all type "1" atoms to "1.0".

"pair_style lj/cut 3.0" sets the pairwise interactions between particles to follow a Lennard Jones Potential and ignore interactions above "3.0".

"pair_coeff * * 1.0 1.0" sets the coefficients of pairwise force field interactions between pairs of any type of atoms to "1.0". In this case, they would be ϵ and σ of the Lennard Jones Potential.

The specification of initial position and velocity allows the use of the velocity-verlet algorithm.

Running the Simulation

Generalising the input script with variables such as "n_steps" allows convenient altering of the input script. This is especially helpful when the same value is used multiple times within the script since the value only needs to be assigned to the text variable once.

Equilibration

Thermodynamic quantities of a simulated system (0.001 timestep) are plotted below to verify if they reach a constant average which indicates an equilibrium state.

Energy against Time
Temperature against Time
Pressure against Time


A constant average for all three thermodynamic quantities was obtained within the duration of simulation which indicates that equilibrium was obtained in all cases. The time required to attain equilibrium was approximately 0.30 for each thermodynamic quantity.


Energy against Time for all timesteps


The largest timestep to give acceptable results is 0.0025 which converged to the same values for 0.001. Above 0.0025, the constant averages obtained were higher than that obtained for a timestep of 0.001. A particularly bad choice would be to use a timestep of 0.015. In this particular simulation, equilibrium was not obtained.

Running simulations under specific conditions

Thermostats and Barostats

EK=32NkBT

12imivi2=32NkBT

12imi(γvi)2=32NkB𝔗

γ2(12imivi2)=32NkB𝔗

γ2(32NkBT)=32NkB𝔗

γ2=𝔗T

γ=𝔗T

Examining the Input Script [1]

'100' refers to the number of timesteps between the sampling of each set of input values.

'1000' refers to the number of times each input value is sampled so that an average can be calculated.

'100000' refers to the number of timesteps between each time an average is calculated.

The amount of time simulated is the number of steps, '100000', multiplied by the size of each timestep. In this experiment, a timestep of 0.002τ was used. Thus, the simulations were 200τ long.

Plotting the Equations of State

The temperatures (T*) chosen are 2.0, 2.5, 3.0, 3.5 and 4.0 which are above the critical temperature to ensure liquification does not occur. The pressures (P*) chosen are 2.0 and 3.0. Using combinations of the two parameters, 10 simulations were run with a timestep of 0.002τ and the results are plotted below. A corresponding ideal gas law plot is drawn in orange for each pressure as well. The ideal gas law plot was obtained from taking into account Lennard-Jones reduced units of temperature and pressure (NV)=(P*T*) where (NV) is the density.

P* = 2
P* = 3

The simulated density is lower than that predicted by the ideal gas law. In the ideal gas law, particles do not interact and the volume occupied by particles is negligible compared to the volume of the container. In this simulation, there are repulsive interactions introduced by the use of the Lennard Jones potential. Hence, on average, the simulated particles are further apart from one another compared to a scenario with ideal particles.

This discrepancy between the simulated density and the ideal density increases with increasing pressure. At higher pressures, particles are closer to one another due to the reduced volume which leads to higher repulsive interactions. Thus, on average, the simulated particles are further apart from one another compared to a scenario with ideal particles.

Calculating heat capacities using statistical physics

Heat Capacity Calculation

Attached below is an example of an input script.

### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###
variable T equal 2.0
variable d equal 0.8
variable timestep equal 0.002

### DEFINE SIMULATION BOX GEOMETRY ###
lattice sc ${d}
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

### 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

### SWITCHING OFF THERMOSTAT ###
unfix nvt
fix nve all nve

### MEASURE SYSTEM STATE ###
thermo_style custom step etotal temp press density atoms vol
variable atoms equal atoms 
variable dens equal density
variable temp equal temp
variable temp2 equal temp*temp
variable etotal equal etotal
variable etotal2 equal etotal*etotal
variable vol equal vol
variable press equal press
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_etotal2 v_etotal v_temp2
run 100000

variable avedens equal f_aves[1]
variable avetemp equal f_aves[2]
variable avepress equal f_aves[3]
variable aveetotal2 equal f_aves[4]
variable aveetotal equal f_aves[5]
variable hcapacity equal ${atoms}*${atoms}*((f_aves[4]-f_aves[5]*f_aves[5])/(f_aves[6]))

print "Averages"
print "--------"
print "Number of Atoms: ${atoms}"
print "Heatcapacity: ${hcapacity}"
print "Volume: ${vol}"
print "Density: ${avedens}"
print "Energy: ${aveetotal}"
print "Energy2: ${aveetotal2}"
print "Temperature: ${avetemp}"
print "Pressure: ${avepress}"

Simulations were then conducted at T* of 2.0, 2.2, 2.4, 2.6, 2.8 with ρ* values of 0.2 and 0.8. Thus, CV/V was plotted as a function of T* and the plots are shown below.

Heat capacity was calculated using the relationship where CV=ET=N2E2E2kBT2.

Graph of CvV against T

The trends observed are as expected. Firstly, values of CvV decreased with increasing temperature. This is because at higher temperatures, it will be easier to access higher energy levels (vibrational) and thus less energy is required to access the higher energy levels. As a result, heat capacity decreases since heat capacity is the amount of heat energy required to raise the temperature of a system by one degree.

Secondly, values of CvV increased with higher density. At higher density, there is a greater number of atoms per unit volume which means that heat capacity should be higher since there are more energy levels that can be occupied to store energy in a given volume. As a result, CvV increased. However, since heat capacity is an extensive property, 0.8ρ* would suggest a four times increase in the CvV value compared to at 0.2ρ*. This is not the case in this simulation, possibly due to errors from the relatively small size of the simulated system.

Structural properties and the radial distribution function

The phases were simulated using the specified temperatures and densities as shown below.

Phase Temperature Density
Vapour 1.0 0.1
Liquid 1.0 0.8
Solid 1.0 1.3


Graph of g(r) against r
Graph of g(r)dr against r

The RDF for the solid phase reveals 3 sharp peaks which correspond to the first 3 nearest neighbours on the FCC lattice used to simulate the solid phase. This indicates that the structure of the solid phase is rigid where the atoms vibrate about fixed positions and long range order. The fluctuations correspond to the defects in the solid and further lattice points.

The RDF for the liquid phase reveals 1 sharp peak followed by 2 broader peaks before quickly attaining a constant value of 1. This indicates a lack of long range order but a presence of short range order where nearby atoms can interact and order themselves.

The RDF for the vapour phase reveals 1 sharp peak and quickly attaining a constant value of 1. This indicates an even more pronounced lack of long range order compared to the liquid phase with entirely no short range order. Thus, the vapour phase is the most disordered phase.

Illustration of the first 3 lattice points of the simulated FCC solid

Using the red point as the reference lattice point, the green points are the nearest neighbours, followed by the blue points then the yellow points. The lattice spacing should correspond to the distance to the second nearest neighbours (blue points) which is 1.45 obtained from the second peak in the graph of g(r)againstr for the solid simulation.

Graph of g(r)dr against r for the solid phase

With these points as the 3 nearest neighbours, there are 12, 6 and 24 atoms in increasingly further layers respectively. Furthermore, since coordination number is defined as the number of nearest neighbours, the corresponding coordination numbers for the 3 peaks are 12, 6 and 24 respectively which corresponds to the graph of g(r)dr against r for the solid phase as shown below. It is to note that the integrals correspond to the number of atoms.

r Running Integral Coordination Number
1.25 12.0156 12
1.55 17.9772 6
1.85 41.6666 24

Dynamical properties and the diffusion coefficient

The Lennard Jones simulations[2] for a vapour, liquid[3], and solid phase were run using the specified densities and temperatures as shown below.

Phase Temperature Density
Gas 1.0 0.1
Liquid 1.0 0.8
Solid 1.0 1.3

Mean Squared Displacement

Phase 8 thousand atoms 1 million atoms
Vapour
Graph of total MSD against Timestep for Gas
Graph of total MSD against Timestep for Gas
Liquid
Graph of total MSD against Timestep for Liquid
Graph of total MSD against Timestep for Liquid
Solid
Graph of total MSD against Timestep for Solid
Graph of total MSD against Timestep for Solid

Using the relationship where D=16r2(t)t, D values were calculated for each system simulated.

Phase 8 thousand atoms 1 million atoms
Vapour 1.3001 2.9332
Liquid 0.0702 0.0875
Solid 0.0006 0

Velocity Autocorrelation Function

The normalised velocity autocorrelation function for a 1D harmonic oscillator[4] is evaluated and shown below,

C(τ)=v(t)v(t+τ)dtv2(t)dt

Then substituting,

x(t)=Acos(ωt+ϕ)

v(t)=dx(t)dt=Aωsin(ωt+ϕ)


C(τ)=A2ω2sin(ωt+ϕ)sin(ωt+ωτ+ϕ)dtA2ω2sin2(ωt+ϕ)dt

C(τ)=sin(ωt+ϕ)sin(ωt+ωτ+ϕ)dtsin2(ωt+ϕ)dt

C(τ)=sin(ωt+ϕ)(sin(ωt+ϕ)cos(ωτ)+cos(ωt+ϕ)sin(ωτ))dtsin2(ωt+ϕ)dt

C(τ)=cos(ωτ)sin2(ωt+ϕ)dt+(sin(ωt+ϕ)cos(ωt+ϕ)sin(ωτ))dtsin2(ωt+ϕ)dt

C(τ)=cos(ωτ)+(sin(ωt+ϕ)cos(ωt+ϕ)sin(ωτ))dtsin2(ωt+ϕ)dt

C(τ)=cos(ωτ)+sin(ωτ)(sin(ωt+ϕ)cos(ωt+ϕ))dtsin2(ωt+ϕ)dt

C(τ)=cos(ωτ)+sin(ωτ)sin2(ωt+ϕ)dtsin2(ωt+ϕ)dt

C(τ)=cos(ωτ)+sin(ωτ)sin2(ωt+ϕ)dt(1cos2(ωt+ϕ))dt


Asx,

sin(x)x0 and cos(x)x0

C(τ)=cos(ωτ)

The VACFs from the liquid and solid simulation as well as the analytic solution are plotted below.

VACFs for liquid and solid, and analytic solution

The minimum of the VACFs represent a reversal in the velocity of the particle. The liquid and solid VACF both taper down due to the decorrelation of the velocity with time. However, it is to note that the solid phase decorrelates slower than the liquid phase. In the solid phase, the atoms vibrate about a fixed point and a perfect oscillation would be obtained in an ideal scenario. However, there are other perturbative forces which disrupt this oscillatory motion resulting in a damped harmonic motion leading to a gradual decay. On the contrary in the liquid phase, the atoms do not vibrate about a fixed point. However, there are diffusive forces which disrupt any oscillatory motion even more rapidly than the perturbative forces in the solid phase. Thus, it can be observed that a very damped oscillation occurs which quickly decays. This can be thought of as two atoms colliding with one another and then quickly diffusing away.

It is noted that the harmonic oscillator VACF is very different to the Lennard Jones solid and liquid as described above. This is due to the harmonic oscillator VACF not taking into account any disruptive forces that can destroy the oscillatory motion. As a result, perfect oscillation can be observed where the initial velocity correlates to every subsequent velocity.

The running integrals for each simulated system were calculated using the trapezium rule and are shown below.

Phase 8 thousand atoms 1 million atoms
Vapour
Graph of VACF against Timestep for Vapour
Graph of VACF against Timestep for Vapour
Liquid
Graph of VACF against Timestep for Liquid
Graph of VACF against Timestep for Liquid
Solid
Graph of VACF against Timestep for Solid
Graph of VACF against Timestep for Solid

Using the relationship where D=130dτv(0)v(τ), D values were calculated for each system simulated. The VACF values at 5000 timesteps were used.

Phase 8 thousand atoms 1 million atoms
Vapour 1.34409 3.26851
Liquid 0.08258 0.09009
Solid 0 0

The D values obtained through VACF are similar to that obtained through MSD. It is to note that the D values increase from the solid to the liquid to the vapour phase for both methods which is an expected result. The D values for the solid are approximately zero which is expected since the atoms are vibrating about a fixed point. However, the D values obtained for the vapour phase are significantly different for the small system and the larger system. This error is attributed to an inaccurate simulation due to the small number of atoms used in the smaller system. It is expected that the real value of D is closer to that of the value obtained from the 1 million atoms system for both the MSD and VACF simulation. The largest source of error is the length of time the simulations are run for. It is clear from the simulations above that the VACF values are still increasing for the liquid and vapour phases. This indicates that the actual D values are higher than that of the simulated values.

References

  1. 1.0 1.1 LAMMPS Manual, http://lammps.sandia.gov/doc/Section_commands.html#individual-commands. Accessed on 12 March 2017.
  2. J. Hansen and L. Verlet, Phase Transitions of the Lennard-Jones System, Phys. Rev., 1969, 184, 151.
  3. D. Chandler, Equilibrium Structure and Molecular Motion in Liquids, Acc. Chem. Res., 1974, 7, 246.
  4. D. Levesque and L. Verlet, Computer "Experiments" on Classical Fluids. III. Time-Dependent Self-Correlation Functions, Phys. Rev. A, 1970, 2, 2514.