Jump to content

Talk:Mod:DSB113

From ChemWiki

Completing Harmonic Oscillator

The Velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator.

Energy in this case was just kinetic energy not total energy. The kinetic energy is calculated using the formula KE=0.5mv2. Potential energy was added to this using the formula Φ= 0.5kx2, where k is the force constant and x is distance. file= This formula was used to calculate the analytical solution. Error was found by subtracting the absolute values of Analytical from x(t).

Calculation Parameters

Φ 0.00
A 1.00
ω 1.00
mass 1.00
k 1.00
original timestep 0.1
updated timestep 0.2

The position of maxima in error were estimated and plotted against time generating the formula; y = 0.0004x- 7E-05. The timestep was varied to provide an error within 1%. The timestep used was 0.2, as increasing the timestep increased the error. The original timestep used through the Harmonic Oscillator model was 0.1. This reduced the error. It is important to monitor the total energy of a physical system to ensure energy is conserved and to see any changes.

file=

Graph showing the Analytical solution against timestep

file=

Graph showing the Kinetic Energy against timestep

file=

Graph showing the error against timestep

file=

Graph showing the maximum error against timestep

file=

Graph showing the total energy against timestep

The graphs above are for a timestep of 0.1. The graphs below show an increase in timestep to 0.2 providing an error within 1%.

file=

Graph showing the Analytical solution against timestep when timestep has been doubled from 0.1 to 0.2

file=

Graph showing the Kinetic Energy against timestep when timestep has been doubled from 0.1 to 0.2

file=

Graph showing the error against timestep when timestep has been doubled from 0.1 to 0.2 to ensure error is only 1%

Lennard-Jones Interaction

When the potential energy is zero, the formula rearranges to show that r0=σ.

The force at this separation is calculated by differentiating file= to give file=

file=

NJ: Use a decimal, not a fraction, for these integrals.

As the lower boundary increases with respect to sigma, the value of the integral decreases.

Periodic Boundary Conditions

Realistic volumes of liquid cannot be simulated due to the number of water particles involved as shown below.

The number of water molecules in 1ml of water under standard conditions is calculated using density of water and Avagadros Number. 1ml=1g, 1/18 (Molar mass of water) x 6.022 x 1023 =3.34 x 1022.

The volume of 10000 water molecules is calculated by doing the reverse of above. 10000/(6.022 x 1023) = 1.66 x 10-20. This is the number of Moles of 10000 water molecules. Multiply this by 18 to find the mass of 10000 water molecules which is 3 x 10-19 g converted to cm3 is the same as density of water is 1 g/cm3.

If an atom at position (0.5, 0.5, 0.5) moves along vector (0.7, 0.6, 0.2) it ends up at (0.2, 0.1, 0.7) after periodic boundary conditions have been applied.

The Lennard-Jones parameter for argon are σ=0.34nm ε/KB=120K.

If the cutoff is 3.2, r is 1.088 in real units as r*= r/σ. NJ: Units?

The well depth is 1.656 x 10-21 as ε/KB=120K where ε is the well depth and KB is the Boltzmann constant.

Similarly if the reduced temperature (T*) is 1.5, T is 180K in real units as T* = (kBT)/ ε

Creating the Simulation Box

As there is no order a single point of reference cannot be used to find positions of all other atoms in liquid and vapour phases.

Giving atoms random starting coordinates causes problems in simulations as atoms may land on top of each other and repel causing minor explosions.

If the distance between points of a lattice are 1.07722 in reduced units, the number density of a 0.8

1 lattice point.

For a face-centred cubic lattice, with a number density of 1.2, the side length of the cubic unit cell is 1.36 in reduced units. Through the create_atoms command, 3000 atoms would be created if this lattice had been defined.

NJ: It's four atoms per unit cell, which affects both answers.

Setting the Properties of the atoms

The purpose of:

mass 1 1.0

is to define the mass of atom type 1 which is 1.0

pair_style lj/cut 3.0

is defining the Lennard-Jones cutoff as 3.0 with no coulomb interaction.

pair_coeff ** 1.0 1.0

defines that for each type of atom and each other type of atom, the interaction remains the same at 1.0. NJ: What do you mean by this?

Since both xi (0) and vi (0) are being specified, the Velocity-Verlet algorithm will be used.

The reason just

timestep 0.001
run 100000

is not written is due to the fact that the timestep being used numerous times. Using the other method makes it easier to change timesteps and hence easier to compare the results. NJ: This section makes sure that you always simulate the same time (nsteps*dt), no matter what timestep is chosen.

Checking Equilibration

It is of paramount importance that the system reaches equilibrium state.

file=

Graph showing the Total Energy against timestep

file=

Graph showing the Pressure against timestep

file=

Graph showing the Temperature against timestep

file=

Graph showing the Total Energy against timestep at individual timesteps

The simulation reaches equilibrium at 0.41. A timestep of 0.01 is the largest to give acceptable results. The 0.015 timestep is a particularly bad choice as the simulation doesn't reach equilibrium. The energy of this time step decreases initially before increasing rapidly.

NJ: 0.01 is a bit big. We don't really want the average energy to depend on the choice of timestep - the two smallest timesteps, 0.001 and 0.0025 should give approximately the same results. 0.0025 is then the best choice because we get more time out of the simulation for the same number of steps.

Temperature and Pressure Control

The systme upto this point was run under a microconical ensemble. Now the system will be run under isobaric-isothermal ensemble. The timestep used for this is 0.0075

Temperature

Pressure 1

Pressure 2

1.6

2.6

3.5

2.0

2.6

3.5

2.4

2.6

3.5

2.8

2.6

3.5

3.2

2.6

3.5

As T fluctuates, a constant factor is used to ensure the target temperature is achieved. If temperature is higher than target, the constant is less than 1 however, if the target is higher than the temperature the constant is greater than 1. Using these 2 equations:

file=

by dividing the first equation from the second equation, it can be seen that γ=(𝔗T) NJ: Show a bit more working.

If the ave setting is window, then the values produced on timesteps that are multiples of Nfreq are summed and averaged within a moving “window” of time, so that the last M values are used to produce the output. E.g. if M = 3 and Nfreq = 1000, then the output on step 10000 will be the average of the individual values on steps 8000,9000,10000. Outputs on early steps will average over less than M values if they are not available.

Values of temperature will be sampled every 100 units for the average. 1000 measurements contribute to the average. Since the timestep used in this case is 0.0075 and there are 1000 measurements, the time simulated will be 7.5

Plotting Equations of State

file=

Graph showing density against temperature at pressure of 2.6 with error bars

file=

Graph showing density against temperature using the ideal gas law at pressure of 2.6

file=

Graph showing density against temperature at pressure of 3.5 with error bars

file=

Graph showing density against temperature using the ideal gas law at pressure of 3.5

NJ: It might be easier to see this if you plot them all on the same graph. The simulated density using the ideal gas law simulates higher densities at both pressures due to assumptions made under the law. The ideal gas law doesn't account for molecular size or intermolecular interactions. As temperature increases, the effect of intermolecular interactions decreases. As pressure increases the discrepancy increases. NJ: Can you flesh this answer out a bit more?

Calculating Heat Capacity

In thermodynamics, many quantities can be calculated by considering how much the system can fluctuate from its average equilibrium state.

file=

Graph showing Heat capacity/volume against temperature at density of 0.2 and 0.8

A copy of an example input script can be found here Media:d8t28.ogg. This is an example when density is 0.8 and Temperature is 2.8.

At both densities, the heat capacity/volume decreases as temperature increases. Lower density has lower heat capacity as heat capacity is an extensive property as it measures amount of heat required to change temperature by 1 degree. A large quantity of matter has a proportionally large heat capacity. Specific heat capacity is the amount of heat required to change the temperature of one unit of mass of a substance by one degree. Specific heat is therefore an intensive variable and has units of energy per mass per degree.

NJ: Why do you think it changes with temperature as it does?

Radial Distribution Function

The RDF provides the distance between an atom and its nearest neighbour, second nearest, etc. It can be found experimentally hence ensures the simulation is reproducing correctly. The atomic trajectory is recorded to generate the RDF.

file=

Graph showing the Radial Distribution Function denoted by g(r) of the 3 phases against timestep

NJ:The vapour graph is very strange. What conditions did you use? file=

Graph showing the integrated radial distribution function of the 3 phases against timestep

file=

FCC lattice representation

The RDF shows the distance between x from the centre of the atom and the probability. A gas phase has very few neighboring atoms as the RDF shows the fewest peaks while solid has the most neighboring atoms and hence the most peaks. The first 3 peaks correspond to the 4 atoms closest to the atom being observed, followed by the atom in a similar position but 1 up and finally another 4 atoms which are 1.5 up.

NJ: I don't understand this sentence. How can 3 peaks correspond to 4 atoms?

Peaks 1 and 3 correspond to 4 atoms as the atoms are equidistant from the atom being observed. The lattice spacing is 0.8 in reduced units calculated by finding the difference between 2 maximas which correspond to 0.5 of the hypotenuse.

NJ: It's not. You need to work out the distance between the neighbours for each of the three peaks. You then have thee different estimates for a, which you can average.

The coordination number for each of the first 3 peaks is 12, 18 and 42 respectively. This is found by looking at the first 3 minimas after a peak on g(r) and finding the equivalent timestep and hence the integrated g(r) value.

NJ: This would be clearer if you have included a "zoomed in" version of the integral. The coordination is only the area under each peak. So the first is 12, the second is 18-12=6, etc.

Mean Squared Displacement

The MSD provides information on how much atoms in the simulation move around, characterised by the diffucsion coefficient.

file=

Graph showing the mean squared displacement against timestep for a liquid

file=

Graph showing the mean squared displacement against timestep for a solid

file=

Graph showing the mean squared displacement against timestep for a vapour

file=

Graph showing the mean squared displacement against timestep for a liquid for a million particles

file=

Graph showing the mean squared displacement against timestep for a solid for a million particles

file=

Graph showing the mean squared displacement against timestep for a vapour for a million particles

The estimated D for liquid is 0.0849 reduced units, for solid its 0.0000005 reduced units and for vapour, its 0.39215 reduced units. The general trend observed is what is expected. A solid is tightly packed so will not move much however, a vapour is loosely packed and hence has the highest D. Increasing the number of particles to a million has very little effect on the Solid and liquid where D remains near the same, 0.000005 and 0.08726. However there is a large difference for the vapour phase which has D of 2.933 reduced units.

NJ: Why do you think this is? Can you explain the curvature in the vapour MSD?

Velocity Autocorrelation Function

The diffusion coefficient can also be calculated using VACF which provides the difference in velocity between 2 different times. Velocities should not be correlated at long times indicating velocity is random.

file=

file=

Graph showing the 1D harmonic oscillator function of the Velocity Autocorrelation Function denoted by C(t)

file=

Lennard-Jones liquid and solid harmonic oscillator VACF.

The minima in the VACFs for liquid and solid system represents the repulsion between atoms as the repulsive forces are stronger when the atoms are closer together. At the maxima, the atoms are moving in the same direction as there is a strong correlation. The difference between the liquid and solid is that liquid particles are able to move more compared to solid particles, this dampens the VACF as liquid particles have weaker inter-particle interactions. The harmonic oscillator is different to the Lennard Jones solid and liquid as the harmonic oscillator is not driven or damped. LJ solid and liquid account for friction/damping which slows the motion of the system by decreasing the velocity.

NJ: Precisely - the negative regions of the VACF correspond to collision with other atoms. The single minimum in the liquid VACF is due to collision with the "solvent cage".

Phase Running Integral Diffusion Coefficient
Gas 3.382857 1.127619
Liquid 0.587281 0.19576
Solid -0.00111 -0.00037

file=

Integral for a liquid against timestep

file=

Running Integral for a liquid against timestep

file=

Integral for a solid against timestep

file=

Running Integral for a solid against timestep

file=

Integral for a vapour against timestep

file=

Running Integral for a vapour against timestep

The Integral was calculated using the trapezium rule. The first 2 values of the total VACF were added and multiplied by the timestep in this case 0.002. This found the integral. The second integral was found by adding the second and third VACF and multiplying by timestep and so on. The running integral is essentially a cumulative frequency of the integrals. The largest source of error is the size of each trapezium, decreasing the size will increase the accuracy.

NJ: How do the VACF results compare with the MSD ones?