Jump to content

Talk:Mod:ym28142814

From ChemWiki

JC: General comments: Most tasks answered, but some detail missing, especially in the explanations of what your results show and why. Try to answer the tasks more thoroughly and discuss the trends in your data and whether this is what you would expect.

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:

xi(t+δt)=xi(t)+vi(t+12δt)δt

The position of a classical harmonic oscillator is calculatd by x(t)=Acos(ωt+ϕ). In this case, A=1.00, ϕ=0.00 and ω=1.00.

Figure 1:classical solution and velocity-Verlet solution for the position at time t

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.

Figure 2:absolute difference between "ANALYTICAL" and velocity-Verlet solution

JC: Why does the error oscillate?

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: E=mv22+kx22, where vand x are the velocity-Verlet solution for velocity and position (m=1.00 and k=1.00).

Figure 3:total energy and its lower and upper limit when timestep is 0.1
Figure 4:total energy and its lower and upper limit when timestep is 0.2

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.

JC: Good choice of timestep.

Atomic Forces

For a single Lennard-Jones interaction, the potential energy can be calculated by ϕ(r)=4ϵ(σ12r12σ6r6). When the potential energy is zero, the separation r0 is equal to the value of σ (r0 = r=σ).

The force acting on an object is determined by the potential that it experiences:

Fi=dU(rN)dri

So the force at this seperation r0 can be calculated as below:


Fi=dϕ(ri)dri


F=d4ϵ(σ12r12σ6r6)dr


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

Since r0 = r=σ,

F=4ϵ(12r012r013+6r06r07)

Therefore the force at r0 can be simplified to :

F=24ϵr0

The equilibrium separation can be found when the force is equal to zero:

F=4ϵ(12σ12r13+6σ6r7)=0


req=26σ

Since ϕ(req)=4ϵ(σ12req12σ6req6), the well depth ϵ can be calculated as following:

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


ϵ=ϕ(req)

Since ϕ(r)=4ϵ(σ12r12σ6r6), ϕ(r)dr can be simplyfied as below:

ϕ(r)dr=4ϵ(σ1211r11σ65r5)

when σ=ϵ=1.0,

2σϕ(r)dr=4ϵ(σ1211×211×σ12σ65×25×σ6)=2.48×102

2.5σϕ(r)dr=4ϵ(σ1211×2.511×σ12σ65×2.55×σ6)=8.18×103

2.5σϕ(r)dr=4ϵ(σ1211×311×σ12σ65×35×σ6)=3.29×103

JC: All maths correct and nicely laid out.

Periodic Boundary Conditions

Mass of one water molecule can be calculated as:

m=MWNA=2.99×1023g

Since ρ=mV and the density of water is 1g/cm3under standard consitions, the volume of 10000 water molecule can be estimated as below:

V=mρ=10000×2.99×10231=2.99×1019cm3

In a single timestep, an atom at position (0.5,0.5,0.5) moves along the vector (0.7,0.6,0.2), the final position is (1.2,1.1,0.7). After applying periodic boundary conditions, the final position is (0.2,0.1,0.7).

Reduced Units

Since r*=rσ=3.2, in real unit r can be calculated as:

r=r*σ=0.34×3.2=1.09nm

Since ϵ/kB=120K, the well depth in kJmol1 can be calculated as:

ϵ=1.38×1023×120×103×6.02×1023=0.997kJmol1

Since T*=kBTϵ, the reduced temperature T*=1.5 in real units can be calculated as:

T=T*ϵkB=1.5×120=180K

JC: Correct.

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).

lattice point number density = number of lattice point/volume of lattice
ρ=11.077223=0.8

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:

l=41.23=1.5

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.

JC: Why do we use a cutoff for the potential? What are the force field coefficients in this case, considering that we are using a Lennard-Jones potential?

xi and vi 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.

JC: This doesn't make sense.

Checking equilibration

Figure 5: Total energy against time for 0.001 timestep
Figure 6: Temperature against time for 0.001 timestep
Figure 7: Pressure against time for 0.001 timestep

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.


Figure 8: energy versus time for all of the timesteps

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.

JC: Give a bit more detail. Total energy should not depend on choice of timestep and 0.0025 is the largest timestep for which this is the case.

Temperature and Pressure Control

Thermostats and Barostats

In our system with N atoms each with 3 degrees of freedom:

EK=32NkBT
12imivi2=32NkBT

In order to get our target temperature 𝔗, every velocity can be multiplied by a constant factor γ:

12imi(viγ)2=32NkB𝔗

This equation can be simplified as below:

γ212imivi2=32NkB𝔗


γ232NkBT=32NkB𝔗


γ2T=𝔗


γ=𝔗T

JC: Correct.

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.

JC: Good explanation.

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 PV=NkBT, which can be used to calculate density as the equation showing below:

ρ=NV=PkBT

Since all variables are in reduced units after simulation and P*=Pσ3ϵ, ρ=Nσ3V, T*=kBTϵ [1], the density predicted by ideal gas law can be calculated as below:


ρ*=σ3NV=σ3PkBT=σ3P*ϵσ3T*ϵ=P*T*


Figure 9:density vs time for both of the pressures

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.

JC: You need to explain why you see these trends. What is the difference between your simulations and an ideal gas and how does that result in the trends that you see?

Calculating heat capacities using statistical physics

The heat capacity of the system can be calculated by the equation showing below:

CV=ET=Var[E]kBT2=N2E2E2kBT2

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 CvV against temperature.

figure 10: Cv/V against temperature for two different densities

According to the equation, the temperature and heat capacity are inversely proportional. So the value of CvV should decrease with temperature.

JC: The numerator in the heat capacity equation (<E> and <E^2>) also depends on temperature so you would have to consider this dependence as well.

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 CvV at ρ=0.8 will be higher than atρ=0.2.

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
Figure 11: RDFs for 3 systems

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 r=σ.

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.

JC: Atoms in a liquid are not on a lattice so no long range order, but they do have short range order.


Figure 12:first 3 peaks in RDF of solid
Figure 13: running integral of RDF of solid

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.

JC: Are these coordination numbers what you would expect? Can you identify the atoms responsible for the first, second and third peaks on an fcc structure? A diagram here would be good. Did you calculate the lattice parameter?

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.

Figure 14a: Simulation for gas
Figure 14b: simulation for liquid
Figure 14c:simulation for solid
Figure 15a: Simulation for gas (much larger system)
Figure 15b: simulation for liquid (much larger system)
Figure 15c: Simulation for solid (much larger 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:

D=16r2(t)t

In this case, r2(t)t=gradient of trend line /timestep.

As for small systems,

vapour: D=16×0.02890.002=2.408

liquid: D=16×0.0010.002=0.083

solid: D=16×6×1090.002=5×107

As for larger systems,

vapour: D=16×0.03050.002=2.542

liquid: D=16×0.0010.002=0.083

solid: D=16×5×1080.002=4.17×106

JC: This equation for the diffusion coefficient is only valid when the MSD graph is linear, so you should only fit the linear part of the graph to a straight line and calculate the gradient, don't use the whole data.

Velocity Autocorrelation Function

The equation for the evolution of the position of a 1D harmonic oscillator as a function of time is shown below:

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

Since v(t)=dx(t)dt,

v(t)=d[Acos(ωt+ϕ)]dt=ωAsin(ωt+ϕ)


v(t+τ)=ωAsin[ω(t+τ)+ϕ=ωAsin[ω(t+ϕ)+ωτ]


Acoording to the trigonometric formula sin(x+y)=sin(x)cos(y)+cos(x)sin(y):


v(t+τ)=ωA[sin(ωt+ϕ)cos(ωτ)+cos(ωt+ϕ)sin(ωτ)]=cos(ωτ)×v(t)ωt[cos(ωt+ϕ)sin(ωτ)]


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


C(τ)=v(t)[v(t)cos(ωτ)ωt[cos(ωt+ϕ)sin(ωτ)]]dtv2(t)dt


C(τ)=cos(ωt)v2(t)dtv2(t)dtωt[cos(ωt+ϕ)sin(ωτ)]dtv2(t)dt


C(τ)=cos(ωt)ωt[cos(ωt+ϕ)sin(ωτ)]dtv2(t)dt

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:

C(τ)=cos(ωτ)

JC: You have the right method, but there is a mistake in your working. The final integral should be cos(omega*t+phi)*sin(omega*t+phi) which is an odd function and so the integral is zero. In your working, you have the integral of cos(omega*t+phi) which is an even function.

The graph below shows the difference between VACFs of Lennard Jones liquid and solid and harmonic oscillator VACF.

Figure 16: VACFs for liquid, solid and ω=12π

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.

JC: There are no collisions in the harmonic oscillator which is why it doesn't decay.

The following equation can be used to calculate D:

D=130dτv(0)v(τ)

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:

Figure 17a: running integral for gas
Figure 17b: running integral for liquid
Figure 17c: running integral for solid

As for larger systems:

Figure 18a: running integral for gas
Figure 18b: running integral for liquid
Figure 18c: running integral for solid

Calculations for values of D for small systems:

gas: D=13×9.27325499=3.091

liquid: D=13×0.293666634=0.098

solid: D=13×0.002980073=9.933×104

As for larger systems:

gas: D=13×9.805397393=3.268

liquid: D=13×0.270274429=0.090

solid: D=13×0.000136588=4.553×105

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

  1. 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
  2. Jean-Pierre Hansen and Loup Verlet, "Phase Transitions of the Lennard-Jones System", Phys. Rev., 184, 151, 1969.DOI:10.1103/PhysRev.184.151
  3. 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