<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://chemwiki.ch.ic.ac.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cew213</id>
	<title>ChemWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://chemwiki.ch.ic.ac.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cew213"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Cew213"/>
	<updated>2026-04-13T18:42:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552931</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552931"/>
		<updated>2016-03-10T21:03:38Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones potential describes molecular interactions, and is made up of a repulsive and an attractive part. A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions, the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated with a small system volume. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The simulations run are carried out in reduced units. The example for argon below demonstrates how reduced units can be converted into real units:&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simulation for the simple cubic lattice with the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms, as there is one atom per unit cell:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines from an input file below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
The input script below describes how average values will be determined. &amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;IN the penultimate line, &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen here: [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units) &amp;lt;ref name=PhysRev &amp;gt;J-P Hanse, L Verlet, &amp;quot;Phase Transitions of the Lennard-Jones System&amp;quot;, &amp;quot;Phys. Rev.&amp;quot;, &amp;quot;1969&amp;quot;. {{DOI||http://dx.doi.org/10.1103/PhysRev.184.151}}&amp;lt;/ref&amp;gt;:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peaks. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3 d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give the result shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt;atoms, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Molecular dynamics simulations can be used to determine a lot of thermodynamic data about a system, and good agreement of simulated data and classically calculated data is seen. However, it is important to note that error can arise due to simulations being run with a small number of atoms, and over a limited period of time.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552927</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552927"/>
		<updated>2016-03-10T20:59:36Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones potential describes molecular interactions, and is made up of a repulsive and an attractive part. A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions, the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated with a small system volume. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The simulations run are carried out in reduced units. The example for argon below demonstrates how reduced units can be converted into real units:&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simulation for the simple cubic lattice with the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms, as there is one atom per unit cell:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines from an input file below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
The input script below describes how average values will be determined. &amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;IN the penultimate line, &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen here: [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units) &amp;lt;ref name=PhysRev &amp;gt;J-P Hanse, L Verlet, &amp;quot;Phase Transitions of the Lennard-Jones System&amp;quot;, &amp;quot;Phys. Rev.&amp;quot;, &amp;quot;1969&amp;quot;. {{DOI||http://dx.doi.org/10.1103/PhysRev.184.151}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peaks. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3 d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give the result shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt;atoms, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Molecular dynamics simulations can be used to determine a lot of thermodynamic data about a system, and good agreement of simulated data and classically calculated data is seen. However, it is important to note that error can arise due to simulations being run with a small number of atoms, and over a limited period of time.&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552926</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552926"/>
		<updated>2016-03-10T20:58:29Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones potential describes molecular interactions, and is made up of a repulsive and an attractive part. A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions, the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated with a small system volume. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The simulations run are carried out in reduced units. The example for argon below demonstrates how reduced units can be converted into real units:&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simulation for the simple cubic lattice with the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms, as there is one atom per unit cell:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines from an input file below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
The input script below describes how average values will be determined. &amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;IN the penultimate line, &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen here: [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units) &amp;lt;ref name=PhysRev &amp;gt;J-P Hanse, L Verlet, &amp;quot;Phase Transitions of the Lennard-Jones System&amp;quot;, &amp;quot;Phys. Rev.&amp;quot;, &amp;quot;1969&amp;quot;. {{DOI||http://dx.doi.org/10.1103/PhysRev.184.151}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peaks. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give the result shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt;atoms, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
Molecular dynamics simulations can be used to determine a lot of thermodynamic data about a system, and good agreement of simulated data and classically calculated data is seen. However, it is important to note that error can arise due to simulations being run with a small number of atoms, and over a limited period of time.&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552919</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552919"/>
		<updated>2016-03-10T20:49:56Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones potential describes molecular interactions, and is made up of a repulsive and an attractive part. A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions, the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated with a small system volume. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The simulations run are carried out in reduced units. The example for argon below demonstrates how reduced units can be converted into real units:&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simulation for the simple cubic lattice with the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms, as there is one atom per unit cell:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines from an input file below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
The input script below describes how average values will be determined. &amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;IN the penultimate line, &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen here: [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units) &amp;lt;ref name=PhysRev &amp;gt;J-P Hanse, L Verlet, &amp;quot;Phase Transitions of the Lennard-Jones System&amp;quot;, &amp;quot;Phys. Rev.&amp;quot;, &amp;quot;1969&amp;quot;. {{DOI||http://dx.doi.org/10.1103/PhysRev.184.151}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552917</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552917"/>
		<updated>2016-03-10T20:45:02Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones potential describes molecular interactions, and is made up of a repulsive and an attractive part. A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions, the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated with a small system volume. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The simulations run are carried out in reduced units. The example for argon below demonstrates how reduced units can be converted into real units:&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simulation for the simple cubic lattice with the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms, as there is one atom per unit cell:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines from an input file below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
The input script below describes how average values will be determined. &amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;IN the penultimate line, &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen here: [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552916</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552916"/>
		<updated>2016-03-10T20:41:52Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Liquid Simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones potential describes molecular interactions, and is made up of a repulsive and an attractive part. A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions, the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated with a small system volume. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The simulations run are carried out in reduced units. The example for argon below demonstrates how reduced units can be converted into real units:&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simulation for the simple cubic lattice with the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms, as there is one atom per unit cell:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines from an input file below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
The input script below describes how average values will be determined. &amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;IN the penultimate line, &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552883</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552883"/>
		<updated>2016-03-10T19:59:40Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi),\ A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552880</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552880"/>
		<updated>2016-03-10T19:59:04Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)\, A = 1.00,\  \omega = 1.00,\  \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552259</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552259"/>
		<updated>2016-03-10T15:16:42Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Mean Squared Displacement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 16 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552235</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552235"/>
		<updated>2016-03-10T15:14:00Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 62.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_62.png&amp;diff=552232</id>
		<title>File:Cew 62.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_62.png&amp;diff=552232"/>
		<updated>2016-03-10T15:13:43Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552213</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552213"/>
		<updated>2016-03-10T15:10:59Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(2.742\times10^{-4})=9.124\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.587)=0.200&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(47.1)=15.7&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(19.6)=6.54&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552174</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552174"/>
		<updated>2016-03-10T15:07:29Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 60.png|500px|center]]&lt;br /&gt;
|[[File:Cew 61.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_61.png&amp;diff=552171</id>
		<title>File:Cew 61.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_61.png&amp;diff=552171"/>
		<updated>2016-03-10T15:07:09Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_60.png&amp;diff=552164</id>
		<title>File:Cew 60.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_60.png&amp;diff=552164"/>
		<updated>2016-03-10T15:06:14Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_51.png&amp;diff=552160</id>
		<title>File:Cew 51.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_51.png&amp;diff=552160"/>
		<updated>2016-03-10T15:05:23Z</updated>

		<summary type="html">&lt;p&gt;Cew213: Cew213 uploaded a new version of File:Cew 51.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552106</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=552106"/>
		<updated>2016-03-10T14:55:12Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, and this can be used to estimate the diffusion coefficient, as described above. &#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms and &#039;&#039;&#039;&#039;&#039;figures 26&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;27&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;28&#039;&#039;&#039;&#039;&#039; show the running integrals for them with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The running integrals for the solid systems show that the VACF reaches equilibrium, where the gradient decreases to close to zero. This is also true for the liquid simulation with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, but not for the other simulations of the liquid and vapour phases. The solid reaches equilibrium the most rapidly as the atoms are able to move the least, but this occurs most slowly in the vapour systems as the particles have more energy so are able to move around more rapidly. This means it takes a longer amount of time for the velocities to reach an average, equilibrium value. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 50.png|500px|center]]&lt;br /&gt;
|[[File:Cew 51.png|500px|center]]&lt;br /&gt;
|[[File:Cew 52.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 53.png|500px|center]]&lt;br /&gt;
|[[File:Cew 54.png|500px|center]]&lt;br /&gt;
|[[File:Cew 55.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 26&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 27&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 28&#039;&#039;&#039;&#039;&#039;: Running integral for the VACF for the Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is that it is impossible to calculate the integral for infinite time, so this introduces error into calculating the diffusion coefficient, especially when the system doesn&#039;t reach an equilibrium state.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_55.png&amp;diff=552065</id>
		<title>File:Cew 55.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_55.png&amp;diff=552065"/>
		<updated>2016-03-10T14:41:43Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_54.png&amp;diff=552058</id>
		<title>File:Cew 54.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_54.png&amp;diff=552058"/>
		<updated>2016-03-10T14:41:12Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_53.png&amp;diff=552055</id>
		<title>File:Cew 53.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_53.png&amp;diff=552055"/>
		<updated>2016-03-10T14:40:41Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_52.png&amp;diff=552033</id>
		<title>File:Cew 52.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_52.png&amp;diff=552033"/>
		<updated>2016-03-10T14:37:54Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_51.png&amp;diff=552030</id>
		<title>File:Cew 51.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_51.png&amp;diff=552030"/>
		<updated>2016-03-10T14:37:21Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_50.png&amp;diff=552018</id>
		<title>File:Cew 50.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_50.png&amp;diff=552018"/>
		<updated>2016-03-10T14:36:06Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551682</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551682"/>
		<updated>2016-03-10T13:09:04Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551679</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551679"/>
		<updated>2016-03-10T13:08:22Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(\omega t+\phi)][-\omega A\ sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A\ sin(a)][-\omega A\ sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2\  sin^2a\ cosb\ + sina\  cosa\  sinb\  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2\ sin^2a\  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2\ cosb\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t} + \frac{A^2\omega^2\ sinb\ \int_{-\infty}^{\infty} sina\  cosa\ \mathrm{d}t}{A^2 \omega^2\ \int_{-\infty}^{\infty} sin^2a\ \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 22&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 23&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;24&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;25&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 23&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 24&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 25&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551667</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551667"/>
		<updated>2016-03-10T13:01:12Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Mean Squared Displacement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 66 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;21&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 16&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 17&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 18&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 19&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 20&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 21&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
!with &amp;lt;math&amp;gt;1000000&amp;lt;/math&amp;gt; atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551659</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551659"/>
		<updated>2016-03-10T12:58:30Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 13&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;14&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 13&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 14&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 15&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 14&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 13&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 15&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551653</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551653"/>
		<updated>2016-03-10T12:56:48Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 12&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1\text{K}&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
The input file for this simulation can be seen [[File:Cew 41.in|here]].&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_41.in&amp;diff=551646</id>
		<title>File:Cew 41.in</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_41.in&amp;diff=551646"/>
		<updated>2016-03-10T12:52:59Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551643</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551643"/>
		<updated>2016-03-10T12:49:07Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551642</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551642"/>
		<updated>2016-03-10T12:47:14Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Temperature and Pressure Control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 10&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;11&#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 10&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 11&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt; pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551640</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551640"/>
		<updated>2016-03-10T12:46:07Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Examining the Input Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for time &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551638</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551638"/>
		<updated>2016-03-10T12:45:12Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Examining the Input Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; is the how often input values will be taken, &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; is the number of times to use input values for calculating averages, and &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; is how often averages are calculated. In this case averages will be calculated every &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps, using &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; measurements from the simulation, which are found by sampling the values every &amp;lt;math&amp;gt;100&amp;lt;/math&amp;gt; timesteps before the average is calculated. The final line is the number of timesteps that the simulation will run for, so in this case &amp;lt;math&amp;gt;100000&amp;lt;/math&amp;gt; timesteps of &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; will be carried out, so the simulation will run for &amp;lt;math&amp;gt;250&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551636</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551636"/>
		<updated>2016-03-10T12:42:53Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Thermostats and Barostats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided by each other to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551633</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551633"/>
		<updated>2016-03-10T12:42:06Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Checking equilibration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 6&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;7&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;8&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest timestep used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for timesteps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 7&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 8&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 9&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551631</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551631"/>
		<updated>2016-03-10T12:40:27Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Creating the simulation box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{lattice spacing}=\sqrt[3]\frac{\text{number of lattice points}}{\text{number density of lattice points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551629</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551629"/>
		<updated>2016-03-10T12:38:09Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Reduced Units */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\text{ nm}, \epsilon\ /\ k_B= 120 \text{ K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088\text{ nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21}\text{ J}=0.99\text{ kJmol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180\text{ K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551626</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551626"/>
		<updated>2016-03-10T12:36:37Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Periodic Boundary Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5\text{ moldm}^{-3}=0.0555\text{ molml}^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}\text{ molecules}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}\text{ ml}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate &amp;lt;math&amp;gt;1\text{ ml}&amp;lt;/math&amp;gt; of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is kept constant, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the simulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551621</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551621"/>
		<updated>2016-03-10T12:30:57Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Atomic Forces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551618</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551618"/>
		<updated>2016-03-10T12:29:59Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Atomic Forces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;figure 5&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551615</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551615"/>
		<updated>2016-03-10T12:28:32Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi = \text{intermolecular potential}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \text{well depth}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sigma = \text{Van der Waals radius}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r = \text{separation distance}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551610</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551610"/>
		<updated>2016-03-10T12:23:17Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy).&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DEFINE TERMS&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551609</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551609"/>
		<updated>2016-03-10T12:21:34Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Introduction to molecular dynamics simulation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 40.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DEFINE TERMS&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_40.png&amp;diff=551607</id>
		<title>File:Cew 40.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Cew_40.png&amp;diff=551607"/>
		<updated>2016-03-10T12:21:06Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551597</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551597"/>
		<updated>2016-03-10T12:08:50Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 28.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of &amp;lt;math&amp;gt;0.21&amp;lt;/math&amp;gt; is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by varying the timestep and calculating the size of the fluctuations of the total energy for the simulation, compared to the average constant energy value that would arise from the harmonic oscillator, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DEFINE TERMS&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551573</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551573"/>
		<updated>2016-03-10T09:56:17Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Examining the Input Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 28.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CHECK &lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of XXX is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by - varying the timestep and calculating the size of the fluctuations of the total energy for the simulation -, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DEFINE TERMS&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results. The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
HELP  The input file for this simulation can be seen here:&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated. &#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551572</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551572"/>
		<updated>2016-03-10T09:50:44Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Thermostats and Barostats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 28.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CHECK &lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of XXX is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by - varying the timestep and calculating the size of the fluctuations of the total energy for the simulation -, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DEFINE TERMS&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes &amp;lt;math&amp;gt;\frac{1}{2}k_BT&amp;lt;/math&amp;gt;, on average, to the energy. This gives equations one and two, which are divided to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Choose 5 temperatures (above the critical temperature ), and two pressures (you can get a good idea of what a reasonable pressure is in Lennard-Jones units by looking at the average pressure of your simulations from the last section). This gives ten phase points — five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen  points. You should be able to use the results of the previous section to choose a timestep. Submit these ten jobs to the HPC portal. While you wait for them to finish, you should read the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results.&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: 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 &amp;lt;math&amp;gt;\left(\frac{N}{V}\right)&amp;lt;/math&amp;gt;. 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?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Simulations in this Section===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the D subfolder, there is a file &#039;&#039;liq.in&#039;&#039; that will run a simulation at specified density and temperature to calculate the mean squared displacement and velocity autocorrelation function of your system. Run one of these simulations for a vapour, liquid, and solid. You have also been given some simulated data from much larger systems (approximately one million atoms). You will need these files later.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551571</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551571"/>
		<updated>2016-03-10T09:48:05Z</updated>

		<summary type="html">&lt;p&gt;Cew213: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 28.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CHECK &lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of XXX is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by - varying the timestep and calculating the size of the fluctuations of the total energy for the simulation -, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
DEFINE TERMS&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
For simulations, realistic volumes of particles cannot be used as this leads to a huge number of atoms that need to be simulated. This can be shown by considering a system of water molecules:&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, under standard conditions,  the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simulations run it would not be possible to simulate 1 ml of water due to the large number of particles, however, applying periodic boundary conditions allows for bulk systems to be simulated. Applying periodic boundary conditions ensures that the number of particles is always consistent, and an example of applying these conditions is described below:&lt;br /&gt;
&lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions, not outside the sinulation box.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. These values are given in reduced units and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. Instead simulations start from a lattice, which will equilibrate over time. For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and this is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
The properties of the atoms in the simulation are defined by the lines below:&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;. For these simulations the velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
The lines below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
It is important to check that the system reaches equilibrium over the course of the simulation. For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; is a constant factor that is required to keep the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;, equal. This is required to ensure the kinetic energy of the system remains at the correct value. It can be found using equipartition theory, where each degree of freedom contributes , on average, to the energy. This gives equations one and two, which are divided to ve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of the&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Choose 5 temperatures (above the critical temperature ), and two pressures (you can get a good idea of what a reasonable pressure is in Lennard-Jones units by looking at the average pressure of your simulations from the last section). This gives ten phase points — five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen  points. You should be able to use the results of the previous section to choose a timestep. Submit these ten jobs to the HPC portal. While you wait for them to finish, you should read the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results.&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: 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 &amp;lt;math&amp;gt;\left(\frac{N}{V}\right)&amp;lt;/math&amp;gt;. 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?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Simulations in this Section===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the D subfolder, there is a file &#039;&#039;liq.in&#039;&#039; that will run a simulation at specified density and temperature to calculate the mean squared displacement and velocity autocorrelation function of your system. Run one of these simulations for a vapour, liquid, and solid. You have also been given some simulated data from much larger systems (approximately one million atoms). You will need these files later.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551570</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551570"/>
		<updated>2016-03-10T09:24:13Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Running your first simulation ==&lt;br /&gt;
&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;, &amp;quot;ERROR&amp;quot; should contain the &#039;&#039;absolute&#039;&#039; difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by &amp;lt;math&amp;gt; x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; (the values of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 28.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Experiment with different values of the timestep. 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 &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of XXX is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by - varying the timestep and calculating the size of the fluctuations of the total energy for the simulation -, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK:&amp;lt;/big&amp;gt; For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&#039;&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. This can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: 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?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. &lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of . Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Using the LAMMPS manual, find the purpose of the following commands in the input script:&#039;&#039;&#039;&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script above means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Look at the lines below.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The lines below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ask the demonstrator if you need help.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. Figure 4 shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; can be found by dividing equation one, by equation two, as the equations cancel to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Choose 5 temperatures (above the critical temperature ), and two pressures (you can get a good idea of what a reasonable pressure is in Lennard-Jones units by looking at the average pressure of your simulations from the last section). This gives ten phase points — five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen  points. You should be able to use the results of the previous section to choose a timestep. Submit these ten jobs to the HPC portal. While you wait for them to finish, you should read the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results.&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: 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 &amp;lt;math&amp;gt;\left(\frac{N}{V}\right)&amp;lt;/math&amp;gt;. 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?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Simulations in this Section===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the D subfolder, there is a file &#039;&#039;liq.in&#039;&#039; that will run a simulation at specified density and temperature to calculate the mean squared displacement and velocity autocorrelation function of your system. Run one of these simulations for a vapour, liquid, and solid. You have also been given some simulated data from much larger systems (approximately one million atoms). You will need these files later.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPACES?? The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551569</id>
		<title>Rep:Mod:CEW complab 2</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:CEW_complab_2&amp;diff=551569"/>
		<updated>2016-03-10T09:23:25Z</updated>

		<summary type="html">&lt;p&gt;Cew213: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Liquid Simulations =&lt;br /&gt;
== Running your first simulation ==&lt;br /&gt;
&lt;br /&gt;
== Introduction to molecular dynamics simulation ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;, &amp;quot;ERROR&amp;quot; should contain the &#039;&#039;absolute&#039;&#039; difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by &amp;lt;math&amp;gt; x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; (the values of &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\omega&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Verlet algorithm and the modified velocity-Verlet algorithm can be used to numerically calculate the positions of atoms in a molecular dynamics simulation. These numerical methods require the simulation to be discretised into a series of timesteps, rather than treating the atomic positions, velocities and forces as continuous functions of time. The velocity-Verlet algorithm is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i\left(t + \delta t\right) = \mathbf{v}_i\left(t + \frac{1}{2}\delta t\right) + \frac{1}{2}\mathbf{a}_i\left(t + \delta t\right)\delta t &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{v}_i = \text{velocity of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\delta t = \text{timestep}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{a}_i = \text{accelaration of atom } i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The plot below in &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039; shows the atomic positions as a function of time as calculated by the velocity-Verlet algorithm, and the classical harmonic oscillator, where:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi), A = 1.00, \omega = 1.00, \phi = 0.00.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039; plots the energy as a function of time, which was calculated by summing the kinetic energy term, &amp;lt;math&amp;gt;\frac{1}{2}mv^2&amp;lt;/math&amp;gt;, and the potential energy term, &amp;lt;math&amp;gt;\frac{1}{2}kx^2&amp;lt;/math&amp;gt;, and &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; plots the error, which was calculated as the difference in the positions found by the velocity-Verlet algorithm and the classical harmonic oscillator, as a function of time. &#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039; plots the error maxima from &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039; as a function of time.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 1.png|700px|center]]&lt;br /&gt;
|[[File:Cew 28.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs position for the positions given by the velocity-Verlet algorithm &amp;quot;x(t)&amp;quot;, and by the classical harmonic oscillator &amp;quot;ANALYTICAL&amp;quot;.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of the time vs total energy (kinetic and potential energy.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 3.png|700px|center]]&lt;br /&gt;
|[[File:Cew 4.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs error (difference in positions).&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs error for the error maxima from &#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Experiment with different values of the timestep. 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 &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The choice of timestep can influence the error of the calculation, as a small timestep is desired to most accurately simulate the system but calculations with a smaller timestep take longer to run than those with a larger timestep. By the harmonic oscillator the total energy should be a constant over the course of the simulation, and it was found that a timestep of XXX is required to ensure the total energy does not change by more than 1% over the course of the simulation. This can be determined by - varying the timestep and calculating the size of the fluctuations of the total energy for the simulation -, so monitoring the total energy of of the system when modelling it numerically is important as it allows for the error of the calculation to be determined.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK:&amp;lt;/big&amp;gt; For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A Lennard-Jones potential is shown in &#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039; and the equation that governs it is given below:&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 5.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure X&#039;&#039;&#039;&#039;&#039;: Lennard-Jones Potential|none]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting this to zero enables the separation at zero potential, &amp;lt;math&amp;gt;r_o&amp;lt;/math&amp;gt;, to be found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{r^{12}}-\frac{\sigma^6}{r^6}]=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}}=\frac{\sigma^6}{r^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r^6=\sigma^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_o=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The force is the derivative of the potential with respect to the separation and is shown for the Lennard-Jones potential below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;r=r_o&amp;lt;/math&amp;gt; the force is given by: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation,&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, occurs when the force is zero so is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{d\phi(r)}{dr}=\frac{48\epsilon\sigma^{12}}{r^{13}}-\frac{24\epsilon\sigma^6}{r^7}=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{48\epsilon\sigma^{12}}{r^{13}}=\frac{24\epsilon\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;2\sigma^6=r^6&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_{eq}=\sigma\sqrt[6]{2}=1.12\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=r_{eq}&amp;lt;/math&amp;gt; the depth of the potential well is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r)=4\epsilon[\frac{\sigma^{12}}{4\sigma^{12}}-\frac{\sigma^6}{2\sigma^6}]=4\epsilon\times-\frac{1}{4}=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt;, the integral below can be expressed as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=\frac{4}{5r^5}-\frac{4}{11r^{11}}+C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This result can be used to evaluate the integrals below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0082&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=-0.0033&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Taking the concentration of water as &amp;lt;math&amp;gt;55.5 moldm^{-3}=0.0555 molml^{-1}&amp;lt;/math&amp;gt;, the number of molecules of water in 1 ml is the concentration of water multiplied by Avogadro&#039;s number (&amp;lt;math&amp;gt;6.02\times10^{23}&amp;lt;/math&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555\times N_A=3.34\times10^{22}  molecules&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The volume of 10000 water molecules under standard conditions can be found by dividing the number of water molecules by Avogadro&#039;s number to convert to the number of moles of water, and by the concentration of water:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{10000}{0.0555N_A}=2.99\times10^{-19}  ml&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&#039;&#039;&#039;.&lt;br /&gt;
 &lt;br /&gt;
After an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; has been moved along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, it will end up in the position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;, due to the application of periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;, and the cutoff separation is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;. This can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\sigma=1.088 nm&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The well depth is given by &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;, so can be found as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=120k_B=1.656\times10^{-21} J=0.99 kJmol^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reduced temperature is &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt;, and can be converted into real units by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T=\frac{T^*\epsilon}{k_B}=180 K&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: 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?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In these simulations, when particles are too close together they will have a high, repulsive force. Randomly generating the starting coordinates can lead to some atoms being very close to each other, which results in very large repulsive forces between them, and this can cause the calculation to fail due to the size of the force. &lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of . Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice unit cell with lattice spacing &amp;lt;math&amp;gt;1.0772&amp;lt;/math&amp;gt;, the number density of lattice points is found by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{1}{1.0772^3}=0.800&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a face centred cubic (FCC) lattice unit cell with the number density of lattice points &amp;lt;math&amp;gt;1.2&amp;lt;/math&amp;gt;, the lattice spacing can be found using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;lattice\ spacing=\sqrt[3]{\frac{number\ of\ lattice\ points}{number\ density\ of\ lattice\ points}}=\sqrt[3]{\frac{4}{1.2}}=1.4938&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For the simple cubic lattice the input file command below leads to the formation of &amp;lt;math&amp;gt;1000&amp;lt;/math&amp;gt; atoms:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is acknowledged in the ouput file by the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created 1000 atoms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an FCC lattice the input command would lead to the formation of &amp;lt;math&amp;gt;4000&amp;lt;/math&amp;gt; atoms, as there are four atoms per unit cell in the FCC lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Using the LAMMPS manual, find the purpose of the following commands in the input script:&#039;&#039;&#039;&lt;br /&gt;
 mass 1 1.0&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
The first line of the script above means the mass of particle &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, the second line means the global cutoff for the Lennard-Jones interactions is at a distance of &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and the third line means the pairwise force field coefficients for all atoms, from atoms &amp;lt;math&amp;gt;1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;, are &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The velocity-verlet algorithm is being used, as &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt; have been specified.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Look at the lines below.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The lines below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 ### SPECIFY TIMESTEP ###&lt;br /&gt;
 variable timestep equal 0.001&lt;br /&gt;
 variable n_steps equal floor(100/${timestep})&lt;br /&gt;
 variable n_steps equal floor(100/0.001)&lt;br /&gt;
 timestep ${timestep}&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### RUN SIMULATION ###&lt;br /&gt;
 run ${n_steps}&lt;br /&gt;
 run 100000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
could be replaced by &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 timestep 0.001&lt;br /&gt;
 run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The advantages of the first method are that a variable &amp;quot;timestep&amp;quot; is defined, so every time&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
${timestep}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used in the input file, the amount defined by the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
is used. This means the simulation will run for the same amount of time, irrespective of the timestep used as the variable &amp;quot;n_steps&amp;quot; is defined as&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable n_steps equal floor (100/${timestep})&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and this value is then used to determine the number of timesteps the simulation is run for in the line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Using the second method would require the number of timesteps needed to a run a simulation of a certain length to be calculated manually for each timestep used, which would take longer and could lead to errors. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ask the demonstrator if you need help.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Checking equilibration ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For the experiment with the timestep &amp;lt;math&amp;gt;0.001&amp;lt;/math&amp;gt; the simulation does reach equilibrium, at time &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, as can be seen in &#039;&#039;&#039;&#039;&#039;Figures 1&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;, and &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039;. Figure 4 shows a plot of the energy of all five of the experiments, which were each run with a different timestep. It can be seen that the experiment run with timestep &amp;lt;math&amp;gt;0.015&amp;lt;/math&amp;gt; gave a very poor result, as the energy does not reach equilibrium. The largest team step used to give a useful result is &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt; as it reaches equilibrium. However, for timesteps above &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; the energy is dependent on the timestep chosen, which is seen by the energies averaging at increasingly higher values for time steps &amp;lt;math&amp;gt;0.0075&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.01&amp;lt;/math&amp;gt;, so the time step &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt; has been chosen to carry out further calculations.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 6.png|700px|center]]&lt;br /&gt;
|[[File:Cew 7.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of time vs temperature.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 8.png|700px|center]]&lt;br /&gt;
|[[File:Cew 10.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of time vs pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of time vs energy for all of the timesteps.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Running simulations under specific conditions ==&lt;br /&gt;
&lt;br /&gt;
===Thermostats and Barostats===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; can be found by dividing equation one, by equation two, as the equations cancel to give &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; in terms of the instantaneous temperature, &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, and the target temperature, &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Equation one: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{\gamma^2}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Equation two: &amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2=\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt\frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examining the Input Script===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp press density&lt;br /&gt;
variable dens equal density&lt;br /&gt;
variable dens2 equal density*density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable press equal press&lt;br /&gt;
variable press2 equal press*press&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;The penultimate line of the script above describes how average values will be determined. &#039;&#039;100&#039;&#039; is the how often input values will be taken, &#039;&#039;1000&#039;&#039; is the number of times to use input values for calculating averages, and &#039;&#039;100000&#039;&#039; is how often averages are calculated. In this case averages will be calculated every &#039;&#039;100000&#039;&#039; time steps, using &#039;&#039;1000&#039;&#039; measurements from the simulation, which are found by sampling the values every &#039;&#039;100&#039;&#039; time steps before the average is calculated. The final line is the number of time steps that the simulation will run for, so in this case &#039;&#039;100000&#039;&#039; time steps of 0.0025 will be carried out, so the simulation will run for 250.&lt;br /&gt;
&lt;br /&gt;
===Plotting the Equations of State===&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Choose 5 temperatures (above the critical temperature ), and two pressures (you can get a good idea of what a reasonable pressure is in Lennard-Jones units by looking at the average pressure of your simulations from the last section). This gives ten phase points — five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen  points. You should be able to use the results of the previous section to choose a timestep. Submit these ten jobs to the HPC portal. While you wait for them to finish, you should read the next section.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Simulations using the velocity-Verlet algorithm on the Lennard-Jones system were carried out at pressures &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;3.0&amp;lt;/math&amp;gt;, and temperatures &amp;lt;math&amp;gt;0.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;1.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.5&amp;lt;/math&amp;gt; (values in reduced units), with timestep &amp;lt;math&amp;gt;0.0025&amp;lt;/math&amp;gt;. The pressures and temperatures were chosen as they are close to the equilibrium values that were previously calculated, and the timestep was chosen at it was the largest that gave valid results.&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: 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 &amp;lt;math&amp;gt;\left(\frac{N}{V}\right)&amp;lt;/math&amp;gt;. 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?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2 &#039;&#039;&#039;&#039;&#039;show both the computed values for the density using the velocity-Verlet algorithm and the predicted values, found using the perfect gas law with &amp;lt;math&amp;gt;k_B=1&amp;lt;/math&amp;gt; as the simulations are run in reduced units:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{N}{V}=\frac{P}{k_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 11.png|700px|center]]&lt;br /&gt;
|[[File:Cew 20.png|850px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of density versus temperature for 2.5 pressure.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of density vs temperature for 3.0 pressure. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The perfect gas law assumes that the volume of the particles is negligible and that there are no intermolecular interactions between the particles, so is best applied to dilute gas systems. The difference between the computed and predicted values increases with pressure because the system becomes less dilute, so less ideal. The computed values are higher than the predicted values as they were found considering intermolecular interactions, as is instructed in the script by the lines below (purpose of commands discussed previously):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Calculating heat capacities using statistical physics ==&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The heat capacity of a system is the amount of energy needed to increase the temperature of the system by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt;, so is a measure of the amount of thermal energy that can be absorbed. Generally this increases with temperature, as more degrees of freedom are possible (rotational and electronic, in addition to translational) so the system can absorb more thermal energy, but for these simulations the particles are taken as hard spheres so no rotations are possible, and since the simulations are classical no electronic transitions are considered. In the canonical ensemble (NVT) the heat capacity can be calculated using:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}\left[E\right]}{k_B T^2} = N^2\frac{\left\langle E^2\right\rangle - \left\langle E\right\rangle^2}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat capacity was found using this equation for simulations of a Lennard-Jones system, with densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, at temperatures of &amp;lt;math&amp;gt;2.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.2&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.4&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;2.6&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;2.8&amp;lt;/math&amp;gt; (all values in reduced units), with timestep 0.0025. &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows plots of heat capacity over volume vs temperature for each of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:Cew 15.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of heat capacity over volume, vs temperature for a Lennard-Jones system at densities &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;.|none]]&lt;br /&gt;
&lt;br /&gt;
The plot in &#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; doesn&#039;t follow the expected increasing heat capacity with temperature, but instead the heat capacity decreases with temperature. This can be explained by considering that, at higher energies, the energy levels are closer together so for a given energy level there is a higher degeneracy. This means that in order to achieve a specific population of energy levels at a higher temperature, less energy is required than would be needed for the equivalent density of states at a lower temperature.  Also, the heat capacity of the system with density &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; is lower than that of the system with density &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;. This is due to there being more particles per unit volume at the higher density, so to increase the temperature by &amp;lt;math&amp;gt;1K&amp;lt;/math&amp;gt; there are more particles to absorb the energy before the temperature of the system is raised, at the higher density.&lt;br /&gt;
&lt;br /&gt;
== Structural properties and the radial distribution function ==&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures given below (in reduced units):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Phase&lt;br /&gt;
!Density&lt;br /&gt;
!Temperature&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|1.20&lt;br /&gt;
|1.40&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.80&lt;br /&gt;
|1.20&lt;br /&gt;
|-&lt;br /&gt;
|Vapour&lt;br /&gt;
|0.01&lt;br /&gt;
|1.11&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The plots of the radial distribution function (RDF) and its integral from these simulations are shown in &#039;&#039;&#039;&#039;&#039;figures 1&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;2&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 12.png|700px|center]]&lt;br /&gt;
|[[File:Cew 13.png|700px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plots of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plots of the integral of the RDF for the solid, liquid and vapour phases of the Lennard-Jones system.&lt;br /&gt;
|}&lt;br /&gt;
The peaks in the RDFs (&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;) correspond to the nearest neighbours, so the RDF for the solid phase Lennard-Jones system has many clear peak. However, those for the liquid and vapour phases do not due to the absence of long range order so the peaks become too small to be observed as the distance between nearest neighbour is too long. For the solid phase, the first three peaks in the RDF correspond to the first three nearest neighbours, which are illustrated in &#039;&#039;&#039;&#039;&#039;figure 3&#039;&#039;&#039;&#039;&#039;. The coordination numbers for these peaks can be found by comparing the peak positions in the RDF and the integration of the RDF (&#039;&#039;&#039;&#039;&#039;figure 2&#039;&#039;&#039;&#039;&#039;) at the at these positions. This analysis gives the coordination numbers &amp;lt;math&amp;gt;5.5&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;8.1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;18.6&amp;lt;/math&amp;gt; for the first, second and third peaks respectively. The lattice spacing, &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;, can be determined using trigonometry from the first nearest neighbour separation, &amp;lt;math&amp;gt;2R=1.025&amp;lt;/math&amp;gt; (determined from &#039;&#039;&#039;&#039;&#039;figure 1&#039;&#039;&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;a=4Rcos(45)=2R\sqrt{2}=1.450\text{ (3d.p.)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively the lattice spacing can be taken as the distance to the second nearest neighbour, which results in a lattice spacing of &amp;lt;math&amp;gt;1.425&amp;lt;/math&amp;gt;. This is good agreement with the calculated result above.&lt;br /&gt;
 &lt;br /&gt;
[[File:Cew 14.png|500px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: FCC lattice unit cell showing the three nearest neighbours (N.B.: not all atoms in unit cell shown)|none]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical properties and the diffusion coefficient ==&lt;br /&gt;
&lt;br /&gt;
===Simulations in this Section===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the D subfolder, there is a file &#039;&#039;liq.in&#039;&#039; that will run a simulation at specified density and temperature to calculate the mean squared displacement and velocity autocorrelation function of your system. Run one of these simulations for a vapour, liquid, and solid. You have also been given some simulated data from much larger systems (approximately one million atoms). You will need these files later.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The solid, liquid and vapour phases of a Lennard-Jones system were simulated using the densities and temperatures used previously given, and timestep &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. From these simulations the mean squared displacement (MSD) was calculated.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 1 &#039;&#039;&#039;&#039;&#039;to &#039;&#039;&#039;&#039;&#039;6&#039;&#039;&#039;&#039;&#039; below show plots of the MSD vs the timestep for a Lennard-Jones solid, liquid and gas system, with 8000 and 1,000,000 atoms. The gradient of the line increases on moving from the solid to the liquid to the vapour phase, which was expected, as the atoms are able to move most easily in the vapour phase, so will have a greater MSD.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[File:Cew 27.png|500px|center]]&lt;br /&gt;
|[[File:Cew 22.png|500px|center]]&lt;br /&gt;
|[[File:Cew 23.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 8000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 8000 atoms.&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Cew 24.png|500px|center]]&lt;br /&gt;
|[[File:Cew 25.png|500px|center]]&lt;br /&gt;
|[[File:Cew 26.png|500px|center]]&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones solid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 5&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones liquid, with 1000000 atoms.&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 6&#039;&#039;&#039;&#039;&#039;: Plot of MSD vs timestep for a Lennard-Jones vapour, with 1000000 atoms.&lt;br /&gt;
|}&lt;br /&gt;
The diffusion coefficient can be found from the mean squared displacement by the equation below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient of the line, once it has established linear behaviour, can be taken and converted to a function of time (instead of timestep) by dividing the gradient by the timestep, &amp;lt;math&amp;gt;0.002&amp;lt;/math&amp;gt;. This can then be divided by &amp;lt;math&amp;gt;6&amp;lt;/math&amp;gt; to give the diffusion coefficient. The results are summarised below:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;\approx0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.001&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{0.50}{6}=0.083&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.080&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{40}{6}=6.667&amp;lt;/math&amp;gt;&lt;br /&gt;
|Gradient&amp;lt;math&amp;gt;=0.016&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;D=\frac{8}{6}=1.333&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
&lt;br /&gt;
COMPLETE &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; 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.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The velocity autocorrelation function (VACF), given by &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt;, is another method that can be used to calculate the diffusion coefficient, as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF can be found by evaluating :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the 1D harmonic oscillator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v\left(t\right) = \frac{\mathrm{d}x(t)}{\mathrm{d}t}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;x(t)=Acos(\omega t +\phi)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VACF for the 1D harmonic oscillator can be evaluated to give a result of the VACF, as is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega (t+\tau)+\phi)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(\omega t+\phi)][-\omega A sin(\omega t+\phi)]\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a+b)]\mathrm{d}t}{\int_{-\infty}^{\infty} [-\omega A sin(a)][-\omega A sin(a)]\mathrm{d}t}&amp;lt;/math&amp;gt; (&amp;lt;math&amp;gt;a=\omega t+\phi&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;b=t+\tau&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A^2\omega^2  sin^2a cosb + sina  cosa  sinb  \mathrm{d}t}{\int_{-\infty}^{\infty}A^2 \omega^2      sin^2a  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2 cosb \int_{-\infty}^{\infty} sin^2a \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t} + \frac{A^2\omega^2 sinb \int_{-\infty}^{\infty} sina  cosa \mathrm{d}t}{A^2 \omega^2\int_{-\infty}^{\infty} sin^2a \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) =cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039; shows the VACF for a Lennard-Jones solid and liquid, which both show fluctuations due to changes in velocity of the particles. These are caused by collisions with other particles in the system, which cause a change in the direction of the motion of the particle, hence the change in velocity. The differences between the fluctuations observed in the solid and liquid VACFs is due to the distances between the particles, so in the solid the particles are closer together so collide more frequently than in the liquid, which leads to more fluctuations in the VACF for the solid. Furthermore, for both the solid and liquid the VACF decays to zero, as the energy of the particles is dispersed randomly throughout the system upon collisions between particles. The differences between the harmonic oscillator VACF (&amp;quot;analytical&amp;quot;) and the Lennard-Jones solid and liquid system are that there are regular fluctuations in the harmonic oscillator, and that the system doesn&#039;t decay to zero. The regular fluctuations are caused by changes of velocity each time the spring reaches its fully extended state, as is governed by Hooke&#039;s law:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;F=-kx&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The system doesn&#039;t decay to zero because there are no collisions in the harmonic oscillator, so the energy of the particles remains constant and isn&#039;t randomly dispersed among the particles.&lt;br /&gt;
&lt;br /&gt;
[[File:Cew 30.png|700px|thumb|&#039;&#039;&#039;&#039;&#039;Figure 1&#039;&#039;&#039;&#039;&#039;: Plot of the velocity autocorrelation function vs timestep for a Lennard-Jones solid and liquid, and for the harmonic oscillator (&amp;quot;analytical&amp;quot;).|none]]&lt;br /&gt;
&lt;br /&gt;
CHECK &#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The integral under the VACF can be estimated using the trapezium rule, where &amp;lt;math&amp;gt;h=0.002&amp;lt;/math&amp;gt; (the timestep):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{x_0}^{x_n}f(x)\mathrm{d}x=\frac{1}{2}h[y_0+y_n+2(y_2+y_3+...y_{n-1})]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the Lennard-Jones solid, liquid and vapour, with &amp;lt;math&amp;gt;8000&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;1,000,000&amp;lt;/math&amp;gt; atoms, the diffusion coefficients were predicted by the method described above to give the results in the table below. The largest source of error in the estimates of the diffusion coefficient from the VACF is...&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Type of System&lt;br /&gt;
!with 8000 atoms&lt;br /&gt;
!with 1,000,000 atoms&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Solid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(8.758\times10^{-5})=2.919\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(1.3659\times10^{-4})=4.553\times10^{-5}\approx0&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Liquid&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.294)=0.098&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(0.270)=0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Lennard-Jones Vapour&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(23.6)=7.87&amp;lt;/math&amp;gt;&lt;br /&gt;
|&amp;lt;math&amp;gt;D=\frac{1}{3}(9.80)=3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Figures 2&#039;&#039;&#039;&#039;&#039;, &#039;&#039;&#039;&#039;&#039;3&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;4&#039;&#039;&#039;&#039;&#039; show the running integrals for each of the Lennard-Jones solid, liquid and vapour phases. They are as expected/aren&#039;t as expected because....&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 2&#039;&#039;&#039;&#039;&#039;: &lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 3&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|&#039;&#039;&#039;&#039;&#039;Figure 4&#039;&#039;&#039;&#039;&#039;:&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cew213</name></author>
	</entry>
</feed>