Jump to content

Talk:CE1014

From ChemWiki

JC: General comments: All tasks completed, but your written answers were very brief and lacked detail. Try to expand your explanations and go into a bit more depth on what your results show and their significance.

Simulations of Simple Liquids

Theory

Comparing the velocity-Verlet algorithm to the classical solution (x(t)=Acos(ωt+ϕ)) of modelling the displacement of a harmonic oscillator as a function of time.

Displacement of Harmonic oscillator as a function of time using classical solution
Energy as a function of time using velocity-verlet algorithm
Absolute difference between Analytical solution and the velocity-Verlet solution for displacement


It can be seen that the maximum absolute error between the velocity-Verlet and the classical solution increases linearly as a function of time overall.

Maximum error between values of displacement as function of time for time step of 0.01

JC: Why does this happen and why does the error oscillate?

What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your "simulation"? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?

Energy of Harmonic oscillator as a function of time using velocity-verlet algorithm

The largest timestep possible before the energy increases by more than 1% than the average energy of the system is 0.28. The total energy of the system is kept fluctuating between 1% of the average, as energy in a real system must be conserved and the simulation must model this as closely as possible. The timestep 0.285 can be seen in the graph above and is fluctuating at just above 1% of the average energy.

JC: Good choice of timestep.

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

r0 is found where ϕ(r)=0, therefore:

0=4ϵ(σ12r012σ6r06)

σ12σ6r06=0

σ6(r06σ6)=0

r06=σ6

r0=±σ

As r0>0 therefore r0=σ

• Force at r0:

F(r)=dϕ(r)dr

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

When r=r0=σ:

F(r0)=24ϵσ

req is found where dϕ(r)dr=0

4ϵ(12σ12req136σ6req7)=0

2σ6=req6

req=216σ

• Well depth at ϕ(req):

ϕ(req)=4ϵ((σ216σ)12(σ216σ)6)


ϕ(req)=ϵ

When ϵ=σ=1

2σϕ(r)dr

=4[(r1111)(r55)]2

=699281600.0248


2.5σϕ(r)dr

=43918085371093750.00818


3σϕ(r)dr

=3205697430850.00329



Number of molecules in 1 mL of water under standard conditions 3.34 x 1022 molecules.

An atom in a cubic simulation box at position (0.5,0.5,0.5), moves along the vector (0.7,0.6,0.2), will end up in position vector (0.2,0.1,0.7) if periodic boundary conditions are applied.

Volume = 2.99 x 10^-25 m^3 The Lennard-Jones parameters for argon are σ=0.34nm,ϵ/kB=120K. If the LJ cutoff is r*=3.2, what is it in real units? What is the well depth in kJmol1? What is the reduced temperature T*=1.5 in real units?

  • distance r*=rσ

r=r*σ

r=1.09nm

  • energy E*=Eϵ

ϵ=120kB in J

For kJ/mol, multiply by Avogadro's number NA

ϵ=0.998kJmol1

  • temperature T*=kBTϵ

T=T*ϵkB

T=180K

JC: All maths correct and nicely laid out. You should show your working for the number of water molecules in 1 ml and the volume of 1000 molecules.

Equilibriation Tasks

TASK: Why do you think giving atoms random starting coordinates causes problems in simulations? Hint: what happens if two atoms happen to be generated close together?

Generating random coordinates for atoms has the potential to place two atoms less than a radius away from each other, in which case the Lennard-Jones potential would not describe the system. This is not a good approximation to real life liquids as the intermolecular forces would not allow atoms that close.

JC: The Lennard-Jones potential can still describe interactions at distances of < sigma, but the repulsive forces generated when particles are placed very close together can make the system unstable and cause the simulation to crash.

The lattice spacing for a number density of 0.8 for a simple cubic unit cell:


D=mV where D= Number density; m= mass of atom; V=a3= volume, where a is the side length of the cubit unit cell.

Therefore 0.8=1a3 and a=1.07722

Lattice spacing for a face centered cubic lattice:

If D=1.2 and m=4

a=1.49380

For a face-centered cubic lattice with 1000 lattices generated:

4000 atoms would have been created

JC: Values are correct, but you are calculating a number density not a mass density, so m in your equation is the number of atoms in the unit cell rather than the mass.

Meaning of LAMMPS code:

mass 1 1.0 : mass i value; where i = atom type; value = mass of atom

pair_style lj/cut/opt 3.0 : pair_style style args; style = definite style from list (lj/cut corresponds to cut off Lennard-Jones potential with no Coulomb. opt suffix has no effect functionally but means it has been optimized to run faster.); args = arguments used by a particular style (3.0 - cut off point in L-J)

pair_coeff 1 1 1.0 1.0 : pair_coeff I J args - I,J = atom type, coefficients for one or more pairs of atoms interacting with each other

JC: For the Lennard-Jones potential, the coefficients are the values of epsilon and sigma. Why do we use a cut off in the Lennard-Jones potential.

As we are specifying xi(0) and vi(0), the integration algorithm used will be:

velocity-Verlet algorithm

The value ${timestep} variable is always replaced by 0.001 as this is what the variable is set to at the beginning of the script as:

This saves time when writing the simulation script as if we want to change the timestep in another simulation we would only have to input the value in once; where the variable was being set, rather than having to change the timestep each time is appears in the script. This also reduces the likelihood of mistakes as we won't be able to miss one value which could ruin the simulation.

JC: Correct.

Plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment:

Energy as a function of time for timestep 0.001
Temperature as a function of time for timestep 0.001
Pressure as a function of time for timestep 0.001
Energy as a function of time for different time steps

Equilibrium: At time step 0.001, the energy, pressure and temperature all reach equilibrium in a short time of around 0.4 or 40 timesteps.

Choosing timestep: As can be seen from the above graph of energy as a function of time for varying timesteps, the timestep of 0.0025 gives around the same equilibrium value as using 0.001, but the simulation will not take as long as it's a higher value. For the values above 0.0025 the equilibrium energy is dependent on timestep, therefore although the simulation will take less time to run with shorter timesteps, it will not give us the accuracy needed. Therefore 0.0025 is the optimum timestep to choose out of the ones tested here. 0.015 is the worst timestep out of those tested as the total energy does not equilibriate in the time given.

JC: Good choice of timestep and justification.

Running Simulations Under Specific Conditions Tasks

Pressures ,p, and temperatures, T, chosen for Npt calculations:

p=2.75 and 3.0

T=1.6, 1.8, 2.0, 2.2 and 2.4

We need to find γ so that the temperature is correct T=𝔗 if we multiply every velocity γ .

12imivi2=32NkBT

12imi(γvi)2=32NkB𝔗

Determining γ.

12imiγ2vi2=32NkB𝔗

12imivi2=32NkB𝔗γ2

Therefore: 32NkBT=32NkB𝔗γ2

γ2=NkB𝔗NkBT

γ=𝔗T , where we have chosen the positive sign of the square root as we do not want the gamma factor switching the direction of the velocities at each timestep.

JC: Good, clear derivation.

Importance of the three numbers 100 1000 100000 in the line - fix aves all ave/time 100 1000 100000...:

100: Use input value this many timesteps.

1000: Number of times to use input values for calculating averages.

100000: Calculate averages this many timesteps

JC: You should explain what these number mean in your own words and/or give and example so that it is clear that you understand them, rather than just copying the definitions from the LAMMPS manual.

For the next line run 100000 means that 100000 timesteps will be taken of 0.0025 therefore a time of 250.


TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density . Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?

The simulated density is lower than that predicted by the Ideal Gas Law. This is due to the Ideal Gas Law approximating 0 interactions between particles therefore the particles are able to get closer together in a box of specified volume than in our simulation where we use the L-J approximation which includes intermolecular forces.

The discrepancy increases with pressure.

JC: Would you expect the discrepancy to increase with pressure and how does the agreement between the results change with temperature? Don't fit the ideal gas law with a straight line as you know analytically that the ideal gas law will not give a straight line since density = 1/temperature.

Density as a function of temperature for different pressures

Calculating Heat Capacities

TASK: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature (ρ*,T*) phase space, rather than pressure-temperature phase space. The two densities required at 0.2 and 0.8, and the temperature range is 2.0,2.2,2.4,2.6,2.8. Plot CV/V as a function of temperature, where V is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.

Heat capacity per unit volume for different densities

The trend is as expected as CV/V decreases as temperature increases and is consistent with the equation : CV=dEdT

JC: Why is it what you expected, can you give more of an explanation? What are the curved lines on the graph, give the equations for lines of best fit.

Example of input script:

Script
Script


Radial Distribution Function

Radial Distributions for each phase

At radius 0, the RDF is also 0 as atoms cannot pack on top of each other. The solid data has more peaks indicating a regular structure as the atoms are arranged in lattices. The liquid has less peaks corresponding to increasing disorder, and the gas even more so. At large r, g(r) tends to 1 as it gets closer to the density of the whole system.

JC: Try to be a bit more specific, the liquid has short ranged order (peaks at small r), but no long ranged order, unlike in the solid.

Solid RDF The first three peaks are labeled in the above graph which correspond to the 3 nearest atoms from the origin atom. As the structure is FCC we can see from the image below which spacings the 3 peaks correspond to with value 1, 2 and 3 being 0.975, 1.425 and 1.725 respectively. Therefore the lattice spacing is 1.425, corresponding to the the second peak on the graph and spacing labeled 2 on the image below.

The coordination number for each site is as follows:

1 = 12

2 = 6

3 = 24

Lattice spacing

JC: Good idea to include a diagram of an fcc lattice and correct value for the lattice spacing. You could have also calculated this from the first and third peaks and taken an average. How did you get the coordination number, did you plot the integral of the RDF?

Displacement

Plots showing the mean squared displacement as a function of timestep for simulations in different states.

Displacement for each phase

Plot showing MSD for a simulation with 1 million atoms.

Displacement for each phase with 1 million atoms

D=16r2(t)t


r2(t)=mx+c where mx+c is the linear equation from the graphs above.

r2(t)t=m

Therefore D=16m

Solid simulation: D=1.33 x 106

Liquid simulation: D=1.67 x 104

Vapour simulation: D=6.55 x 103

For simulation with 1 million atoms:

Solid simulation: D=8.33 x 109

Liquid simulation: D=1.67 x 104

Vapour simulation: D=6.30 x 103

JC: Data looks good, what are the units?

Velocity Autocorrelation Function

Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):

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

Position of a 1D harmonic oscillator as a function of time: x(t)=Acos(ωt+ϕ)

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

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

=limTTTdtsin(ωt+ϕ)sin(ω(t+τ)+ϕ)TTdtsin2(ωt+ϕ)

TTdtsin(ωt+ϕ)sin(ω(t+τ)+ϕ)=Tcos(ωτ)12ωcos(2ϕ+ωτ)sin(2ωT)

and

TTdtsin2(ωt+ϕ)=T12ωcos(2ϕ)sin(2ωt)

so

C(τ)=limTTcos(ωτ)12ωcos(2ϕ+ωτ)sin(2ωT)T12ωcos(2ϕ)sin(2ωt)


=limTTcos(ωτ)T=limTcos(ωτ)=cos(ωτ)

JC: Derivation looks good, but it would be good to show a few more steps in your working, especially the trigonometric identities that you use to perform the integration.

Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot C(τ) with ω=1/2π and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.

The minima in the graph simulate where atoms have collided. Solid moves very little as lattice structure so D is almost 0 in both cases. The HO is very different as its a approximation and does not take in quantum effects - it is just using classical equations. For our simulation

JC: The simulations are also classical and don't account for quantum effects. The VACF for the solid and liquid decay to zero because of collisions between atoms which randomise the velocities. There are no collisions in the harmonic oscillator.

Liq integer =119.166 where D=39.772

Solid int = -0.571363169 where D=0.190453

Vapour int = 2197 where D=732.43

For 1 million atoms

Liq integer =123.738 where D=41.246

Solid int =0.3745 where D=0.1248

Vapour int =1468.85 where D=489.617