Jump to content

Talk:Mod:sfs114

From ChemWiki

JC: General comments: All tasks attempted, but a few mistakes and some answers could have done with a bit more detail. Make sure you understand the theory behind the tasks and ask yourself whether your results are what you would expect.

Theory

Numerical Integration

The classical solution for the position at time t compares well with the velocity-Verlet solution:

A plot of x(t) against t comparing analytical and velocity-Verlet solutions

The total energy for the oscillator varies as shown:

A plot of energy against time

An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase.

JC: Why does the error oscillate?

A plot of absolute error, with a linear function fitted to the error maxima

The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of 0.028s allows energy fluctuations to be as low as ±1% of the average value.

Energy oscillation with a timestep of 0.028s
Energy oscillation with a timestep of 0.5s

Atomic Forces

For a single Lennard-Jones interaction, ϕ(r)=4ϵ(σ12r12σ6r6).

  • When potential energy is 0, φ(r) = 0 and r=r0
If ϕ=0,(σ12r12σ6r6)=0,
σ12r12=σ6r6
r0=σ
  • The force is given by F=dϕdr=4ϵ(12σ12r13+6σ6r7) and at a potential energy of 0, F=24ϵσ.
  • At equilibrium separation req, dϕdr=0.
0=4ϵ(12σ12r13+6σ6r7)
(12σ12r13=6σ6r7)
req=216σ
  • At equilibrium separation, the well depth:
ϕ(req)=ϕ(216σ)=ϵ
  • ϕ(r)dr=4ϵ[σ1211r11+σ65r5]+c and given that σ=ϵ=1.0 so ϕ(r)dr=4[111r11+15r5]+c
  • 2σϕ(r)dr=4[111r11+15r5]2=4(15(2)5111(2)11)=0.02482
  • 2.5σϕ(r)dr=4[111r11+15r5]2.5=4(15(2.5)5111(2.5)11)=0.008177
  • 3σϕ(r)dr=4[111r11+15r5]3=4(15(3)5111(3)11)=0.00329

JC: All maths correct and clear.

Periodic Boundary Conditions

As pV=NkBT, the number of water molecules in 1 mL of water is approximately 2.46x1019 and 10000 molecules takes up an approximate volume of 4.06x1022m3.

JC: Show more working here, your values are not exactly right.

In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.

Reduced Units

The LJ parameters for Argon are: σ=0.34nm,ϵkB=120K.

  • r=σr*=0.343.2=1.088nm.
  • WellDepth=ϕ(req)=ϵ=kB120=1.65621J
1.65621NA=997.4=0.997kJmol1.
  • T=ϵT*kB=1201.5=180K.

JC: Correct.

Equilibriation

Creating the Simulation Box

If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.

JC: Large repulsive forces cause the simulation to crash.

A lattice spacing of 1.07722 corresponds to a lattice number density of 11.077223=0.8 for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of (41.2)13=1.4938. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.

Setting the Properties of the Atoms

The command mass 1 1.0 assigns all atoms of type 1 a mass of 1.0. The command pair_style lj/cut 3.0 defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance). The command pair_coeff ** 1.0 1.0 specifically defines the pairwise force field coefficients for multiple pairs atoms.

JC: What do you mean "the simulation does not run for atoms farther apart or closer than this distance"? The force field parameters for a Lennard Jones simulation are epsilon and sigma.

The velocity-Verlet algorithm is the numerical integration method that will be used if xi(0) and vi(0) are defined.

Running the Simulation

Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.

JC: Why?

Checking Equilibriation

The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:

Energy equilbriation
Closer look at energy equilibriation
Temperature equilbriation
Closer look at temperature equilibriation
Pressure equilbriation
Closer look at pressure equilibriation
Energy equilibriation for multiple timesteps

Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.

JC: Good choice of timestep, but why not 0.0075 or 0.01? Should the average total energy depend on the choice of timestep?

Running Simulations Under Specific Conditions

Thermostats & Barostats

EK=32NkB𝔗=12imi(γvi)2

γ2=32NkB𝔗12imivi2
γ2=32NkB𝔗32NkBT
γ=(𝔗T)12

Examining the Input Script

The command fix aves all ave/time 100 1000 100000 means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.

run 100000 indicates that 100000 timesteps will be simulated.

Plotting the Equations of State

A plot of density against temperature compared to ideal gas law

Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur, while lower pressures would theoretically behave more as an ideal gas would. For the same reason, error decreases at higher temperatures.

JC: Why does the lack of interactions in the ideal gas mean that it has a lower density than the simulations? The lack of repulsion between particles in an ideal gas should mean that this has a higher density than the simulations. What value of kB did you use, remember it should be in reduced units to match the simulation data.

Calculating Heat Capacities Using Statistical Physics

A plot of heat capacity/volume against temperature

Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations. Alternatively, increasing temperature causes a decrease in band gap, requiring less energy to enter excited states and thus lowering heat capacity.

JC: Good ideas, more analysis beyond this experiment would be needed to properly understand this trend.

An example of the input scripts is below:

Media:inputnpt.in

Structural Properties and the Radial Distribution Function

A plot of RDFs

The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features.

Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.

The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).

A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)
A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)
A plot of the running integral of the RDF of a solid

The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.

JC: Good explanation of your results and nice use of fcc diagram. Could you have calculated the lattice spacing from the first and third peak as well and then taken an average?

Dynamical Properties and the Diffusion Coefficient

Mean Squared Displacement

  • Dsolid=160.00382752458475=6.38x104
  • Dliquid=160.509774821123=0.085
  • Dgas=167.99193006423=1.33

The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.

Total MSD as a function of time of simulated solid
Total MSD as a function of time of simulated liquid
Total MSD as a function of time of simulated gas


1000000 Atoms

Total MSD as a function of time for 1000000 atoms
  • Dsolid=162.79195534196x105=4.65x106
  • Dliquid=160.531614512766=0.0886
  • Dgas=1618.0968139669=3.02

The MSD graph for a gas is curved at first, indicating ballistic motion proportional to T2. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.

JC: Show the lines of best fit that you've used to calculate D on the graphs. Why does the MSD for your solid data increase over time, is this for an fcc lattice?


Velocity Autocorrelation Function

  • x(t)=Acos(ωt+ϕ) and v(t)=dx(t)dt=Aωsin(ωt+ϕ)

C(τ)=v(t)v(t+τ)dtv2(t)dt=sin(ωt+ϕ)sin(ω(t+τ)+ϕ)sin2(ωt+ϕ)dt

  • sin(A+B)=sinAcosB+cosAsinB

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

  • sin2(x)=12(1cos(2x))

C(τ)=[cos(ωτ)12(1cos(2(ωt+ϕ)]+[sin(ωτ)sin(ωt+ϕ)cos(ωt+ϕ)dt]12(1cos(2(ωt+ϕ)dt

  • 12(1cos(2(ωt+ϕ))dt=t2+sin(2(ωt+ϕ)4ω+c
  • sin(ωt+ϕ)cos(ωt+ϕ)dt=sin2(ωt+ϕ)2ω+c

C(τ)=[tcos(ωτ)2+cos(ωτ)sin(2(ωt+ϕ))4ω+sin(ωτ)sin2(ωt+ϕ)2ω][t2+sin(2(ωt+ϕ)4ω]

  • sin(x) is an odd function and integrating between and will result in 0

C(τ)=tcos(ωτ)2t2=cos(ωτ)

JC: You can simplify the derivation and avoid the intergration if you can identify terms in the integral as odd or even functions and then simplify them accordingly.

VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.

A plot of total VACF against τ

Diffusion coefficient estimations, using the trapezium rule:

  • Dsolid=130.43184744815700105=0.144
  • Dliquid=13146.83331703729999=48.9
  • Dgas=131451.848385=484
Plot of running integral of VACF of a solid
Plot of running integral of VACF of a liquid
Plot of running integral of VACF of a gas

1000000 Atoms

A plot of total VACF against τ for 1000000 atoms
  • The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)
  • Dliquid=13123.7270701106=41.2
  • Dgas=131466.443215=489
Plot of running integral of VACF of a solid
Plot of running integral of VACF of a solid
Plot of running integral of VACF of a solid

The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally smaller. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.

JC: Check captions in these figures.