<?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=Yjj14</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=Yjj14"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Yjj14"/>
	<updated>2026-04-03T21:41:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588703</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588703"/>
		<updated>2017-02-23T17:37:41Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Calculating Heat Capacities Using Statistical Physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
We can change the ensemble of a simulation to measure other properties of a system. In this section the simulations will be run under NpT (isobaric-isothermal) ensembles.&lt;br /&gt;
&lt;br /&gt;
The parameters used in the simulation are two different pressures of 2.5 and 3.0 and temperatures 1.5, 1.7, 1.9, 2.1 and 2.3. All the simulations are run with a timestep of 0.0025, which was the previously determined timestep that gives the best balance between length of simulation and accuracy in results.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
Figure 14 is a plot of density against reduced pressure. As temperature increases, density of the system decreases which in turn suggested that the volume increased when the system increased in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
Figure 15 is the same plot with additional lines showing the change in density of ideal gases with different pressures when temperature changes.&lt;br /&gt;
&lt;br /&gt;
The simulated density is lower than the density of an ideal gas, suggesting that in an ideal gas the same number of molecules can occupy less space.&lt;br /&gt;
&lt;br /&gt;
This can be explained as ideal gases assume that there are no interactions between particles. This leads to repulsive forces being non-existent in an ideal gas, allowing particles to be closer to each other.&lt;br /&gt;
&lt;br /&gt;
The simulated systems assume Lennard Jones potentials and when particles become too close to each other, the potential energy increases and they will be pushed apart to occupy a higher volume and lower density.&lt;br /&gt;
&lt;br /&gt;
This discrepancy increases with increased pressure as the difference in densities is larger for the system with a pressure of 3.0 than 2.5.&lt;br /&gt;
&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
In this section a NVT ensemble was simulated to calculate the heat capacity.&lt;br /&gt;
&lt;br /&gt;
Figure 16 shows a plot of heat capacity at a constant volume over volume. It is showing the variation in energy as temperature changes.&lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
The trend shown is expected. As by increasing the energy of a system by increasing temperature, the systems total capacity for heat decreases. Higher densities allow higher heat capacity/volume because there is a lower volume and hence a higher value of heat capacity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588702</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588702"/>
		<updated>2017-02-23T17:36:52Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Calculating Heat Capacities Using Statistical Physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
We can change the ensemble of a simulation to measure other properties of a system. In this section the simulations will be run under NpT (isobaric-isothermal) ensembles.&lt;br /&gt;
&lt;br /&gt;
The parameters used in the simulation are two different pressures of 2.5 and 3.0 and temperatures 1.5, 1.7, 1.9, 2.1 and 2.3. All the simulations are run with a timestep of 0.0025, which was the previously determined timestep that gives the best balance between length of simulation and accuracy in results.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
Figure 14 is a plot of density against reduced pressure. As temperature increases, density of the system decreases which in turn suggested that the volume increased when the system increased in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
Figure 15 is the same plot with additional lines showing the change in density of ideal gases with different pressures when temperature changes.&lt;br /&gt;
&lt;br /&gt;
The simulated density is lower than the density of an ideal gas, suggesting that in an ideal gas the same number of molecules can occupy less space.&lt;br /&gt;
&lt;br /&gt;
This can be explained as ideal gases assume that there are no interactions between particles. This leads to repulsive forces being non-existent in an ideal gas, allowing particles to be closer to each other.&lt;br /&gt;
&lt;br /&gt;
The simulated systems assume Lennard Jones potentials and when particles become too close to each other, the potential energy increases and they will be pushed apart to occupy a higher volume and lower density.&lt;br /&gt;
&lt;br /&gt;
This discrepancy increases with increased pressure as the difference in densities is larger for the system with a pressure of 3.0 than 2.5.&lt;br /&gt;
&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
In this section a NVT ensemble was simulated to calculate the heat capacity.&lt;br /&gt;
&lt;br /&gt;
Figure 16 shows a plot of heat capacity at a constant volume over volume. It is showing the variation in energy as temperature changes.&lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
The trend shown is expected. As in increase the energy of a system by increasing energy, the systems total capacity for heat decreases. Higher densities allow higher heat capacity/volume because there is a lower volume and hence a higher value of heat capacity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588680</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588680"/>
		<updated>2017-02-23T17:23:42Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
We can change the ensemble of a simulation to measure other properties of a system. In this section the simulations will be run under NpT (isobaric-isothermal) ensembles.&lt;br /&gt;
&lt;br /&gt;
The parameters used in the simulation are two different pressures of 2.5 and 3.0 and temperatures 1.5, 1.7, 1.9, 2.1 and 2.3. All the simulations are run with a timestep of 0.0025, which was the previously determined timestep that gives the best balance between length of simulation and accuracy in results.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
Figure 14 is a plot of density against reduced pressure. As temperature increases, density of the system decreases which in turn suggested that the volume increased when the system increased in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
Figure 15 is the same plot with additional lines showing the change in density of ideal gases with different pressures when temperature changes.&lt;br /&gt;
&lt;br /&gt;
The simulated density is lower than the density of an ideal gas, suggesting that in an ideal gas the same number of molecules can occupy less space.&lt;br /&gt;
&lt;br /&gt;
This can be explained as ideal gases assume that there are no interactions between particles. This leads to repulsive forces being non-existent in an ideal gas, allowing particles to be closer to each other.&lt;br /&gt;
&lt;br /&gt;
The simulated systems assume Lennard Jones potentials and when particles become too close to each other, the potential energy increases and they will be pushed apart to occupy a higher volume and lower density.&lt;br /&gt;
&lt;br /&gt;
This discrepancy increases with increased pressure as the difference in densities is larger for the system with a pressure of 3.0 than 2.5.&lt;br /&gt;
&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588654</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588654"/>
		<updated>2017-02-23T17:07:36Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Running Simulations Under Specific Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
We can change the ensemble of a simulation to measure other properties of a system. In this section the simulations will be run under NpT (isobaric-isothermal) ensembles.&lt;br /&gt;
&lt;br /&gt;
The parameters used in the simulation are two different pressures of 2.5 and 3.0 and temperatures 1.5, 1.7, 1.9, 2.1 and 2.3. All the simulations are run with a timestep of 0.0025, which was the previously determined timestep that gives the best balance between length of simulation and accuracy in results.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588651</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588651"/>
		<updated>2017-02-23T17:05:30Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Running Simulations Under Specific Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
We can change the ensemble of a simulation to measure other properties of a system. In this section the simulations will be run under NpT (isobaric-isothermal) ensembles.&lt;br /&gt;
&lt;br /&gt;
The parameters used in the simulation are two different pressures of 2.5 and 3.0 and temperatures 1.5, 1.7, 1.9, 2.1 and 2.3. All the simulations are run with a timestep of 0.002, which was the previously determined timestep that allows an increased time for simulation and &lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588644</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588644"/>
		<updated>2017-02-23T17:01:11Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Running Simulations Under Specific Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
We can change the ensemble of a simulation to measure other properties of a system. In this section the simulations will be run under NpT (isobaric-isothermal) ensembles.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588638</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588638"/>
		<updated>2017-02-23T16:58:03Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588635</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588635"/>
		<updated>2017-02-23T16:57:25Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atom. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, the RDF initially shows a value of zero before a sharp increase just before r=1. The RDF is zero here because the region is the van der Waals radii of the reference particle. If the probability of finding other particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of strong repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588627</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588627"/>
		<updated>2017-02-23T16:53:49Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atoms. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, this RDF initially shows a value of zero before a sharp increase at r=1. Between r=0 and r=1 is the van der Waals radii of the particles, if the probability of finding particles in this range was larger than 0 then the potential energy of the system would dramatically increase and become very unfavoured because of repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588624</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588624"/>
		<updated>2017-02-23T16:52:30Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atoms. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, this RDF initially shows a value of zero before a sharp increase at r=1. Between r=0 and r=1, is the van der Waals radii of the particles, the probability of finding particles in this range would dramatically increase the potential energy of the system and is very unfavoured because of repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure 19 where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588623</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588623"/>
		<updated>2017-02-23T16:52:16Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure 17 and 18.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atoms. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, this RDF initially shows a value of zero before a sharp increase at r=1. Between r=0 and r=1, is the van der Waals radii of the particles, the probability of finding particles in this range would dramatically increase the potential energy of the system and is very unfavoured because of repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588622</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588622"/>
		<updated>2017-02-23T16:51:57Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
The radial distribution function, g(r) shows the probability of finding another atom as a function of distance from a reference atoms. In particular the probability of finding a particle on the surface of a sphere as the radius increases.&lt;br /&gt;
&lt;br /&gt;
In all three systems, this RDF initially shows a value of zero before a sharp increase at r=1. Between r=0 and r=1, is the van der Waals radii of the particles, the probability of finding particles in this range would dramatically increase the potential energy of the system and is very unfavoured because of repulsive forces.&lt;br /&gt;
&lt;br /&gt;
In a gas, the probability of finding other particles quickly averages out as the particles in a gas can easily diffuse. So the probability of find more gas particles quickly becomes the same throughout the system. This is very similar to a liquid, though there is a slight increase in organisation of particles immediately surrounding the reference particle.&lt;br /&gt;
&lt;br /&gt;
In solids the RDF shows discrete peaks as you increase the distance from the reference particle. This shows that the structure of a solid is very organised and a particular unit cell of atoms can be repeated periodically in three dimensions of a lattice.&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588604</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588604"/>
		<updated>2017-02-23T16:35:44Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Plotting the VACF for different simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a more diffusive system. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms are arranged in a solid. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid before averaging out like the liquid.&lt;br /&gt;
&lt;br /&gt;
The difference in the VACF for the harmonic oscillator is mainly due to the fact that a harmonic oscillator observes the conservation of energy during an oscillation. This results in a wave where the maxima and minima of the curve have equal amplitudes. In the Lennard Jones liquid and solid, there are atomic interactions that will interfere with this energy conservation and the velocity averages out.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588597</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588597"/>
		<updated>2017-02-23T16:31:08Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Plotting the VACF for different simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a higher energy, more diffusive liquid. Whereas in the solid, the velocities can much more easily pass back and forth between atoms because how orderly the atoms in a solid are. This leads to a longer period of time where there is a significant oscillation in the velocity of the solid.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588593</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588593"/>
		<updated>2017-02-23T16:28:41Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Plotting the VACF for different simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the maximum velocities of the atoms when they are travelling in opposite directions to their initial velocities.&lt;br /&gt;
&lt;br /&gt;
The VACF for the liquid has an initial higher velocity because it is at a higher energy system than the solid. However it looses this velocity more rapidly than the solid because of the increased probability in collisions in a higher energy, more diffusive liquid.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588586</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588586"/>
		<updated>2017-02-23T16:23:02Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Plotting the VACF for different simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. If there was no interactions in the system, the atoms would retain their velocities and the plot would show a graph with a horizontal line. However the presence of attractive and repulsive forces between atoms cause them to loose their initial energy and initial velocity.&lt;br /&gt;
&lt;br /&gt;
The minima of the VACFs for the liquid and solid represent the velocities of the atoms in these phases and they are travelling in opposite directions to their initial velocities which are at a maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588584</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588584"/>
		<updated>2017-02-23T16:19:46Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Plotting the VACF for different simulations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator. The minima of the VACFs for the liquid and solid represent the velocities of the atoms in the phases opposite &lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588579</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588579"/>
		<updated>2017-02-23T16:16:53Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Plotting the VACF for different simulations ====&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588574</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588574"/>
		<updated>2017-02-23T16:15:48Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 22, shows a plot of the VACF for a liquid and a solid and a harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588572</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588572"/>
		<updated>2017-02-23T16:14:27Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well. The values of D also are expected, as the diffusion coefficient is largest for the vapour phase and lowest for the solid phase. As diffusion is easiest in a gas and much harder in a rigid solid structure.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably from the estimation of the integral. The trapezium method tends to overestimate in its calculation of the area under the curve and so the values of the diffusion coefficient using the VACF are larger than the values of D calculated from the MSD.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588550</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588550"/>
		<updated>2017-02-23T16:01:35Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
The final value of the integral for the vapour, liquid and solid shown in Figures 23-26 divided by three is a good estimate for the diffusion coefficient.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;br /&gt;
&lt;br /&gt;
The largest error for the estimates of D is probably&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588519</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588519"/>
		<updated>2017-02-23T15:37:27Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that value is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Figures 23-26 are the running integrals of the VACF for the three phases, calculated with the trapezium rule. &lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588517</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588517"/>
		<updated>2017-02-23T15:36:18Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure 23: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure 24: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure 25: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure 26: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588516</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588516"/>
		<updated>2017-02-23T15:35:48Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure 22: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and the VACF for a Lennard Jones liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588511</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588511"/>
		<updated>2017-02-23T15:33:21Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588509</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588509"/>
		<updated>2017-02-23T15:32:47Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Table 2 - Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588507</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588507"/>
		<updated>2017-02-23T15:31:29Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values of the diffusion coefficients calculated from a VACF to the values of diffusion coefficients calculated from the mean squared displacement, you can see that the values agree with each other rather well.&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588494</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588494"/>
		<updated>2017-02-23T15:23:52Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| 1.14 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you compare these values ofthe diffusion coefficients calculated from a VACF&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588435</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588435"/>
		<updated>2017-02-23T14:41:15Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
| - 6.20&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588403</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588403"/>
		<updated>2017-02-23T14:10:20Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10-2||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|-6.20&amp;lt;sup&amp;gt;-05&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-05&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588402</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588402"/>
		<updated>2017-02-23T14:09:58Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Table 3 - Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.34||3.27&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10-2||9.01 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|-6.20&amp;lt;sup&amp;gt;-05&amp;lt;/sup&amp;gt;||4.55 x 10&amp;lt;sup&amp;gt;-05&amp;lt;/sup&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588375</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588375"/>
		<updated>2017-02-23T13:47:50Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Molecular Dynamics: Simulation of Liquids */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Table 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1 - Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05||3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10-2||8.72 x 10-2&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10-7||4.39 x 10-6&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588373</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588373"/>
		<updated>2017-02-23T13:45:30Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Values of D for the two simulations of VACF&lt;br /&gt;
!Phase	!!D (Area/time) - VACF	!!D (Area/time) - VACF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05||3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10-2||8.72 x 10-2&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10-7||4.39 x 10-6&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588371</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588371"/>
		<updated>2017-02-23T13:43:00Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
{|&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase	!!D (Area/time) - MSD	!!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05||3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10-2||8.72 x 10-2&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10-7||4.39 x 10-6&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588368</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588368"/>
		<updated>2017-02-23T13:40:22Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that this is one third of the previously calculated integral for the Velocity Autocorrelation Function.&lt;br /&gt;
&lt;br /&gt;
Table 3 shows the diffusion coefficients calculated from the VACF.&lt;br /&gt;
{|&lt;br /&gt;
!&lt;br /&gt;
!&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588251</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=588251"/>
		<updated>2017-02-23T12:50:18Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Estimating D from VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Integral slg.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of the VACF for a liquid and solid.]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Integral slg million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a vapour, liquid and solid.]]&lt;br /&gt;
|[[File:Integral sl million.png|thumb|500px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Integration of 1 million atoms of the VACF for a liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As the diffusion coefficient can also be estimated by this equation: &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;
It can be seen that the integral of the&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586910</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586910"/>
		<updated>2017-02-22T18:08:55Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Running Integrals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Estimating D from VACF ===&lt;br /&gt;
&lt;br /&gt;
[[File:Integral slg.png]]&lt;br /&gt;
[[File:Integral sl.png]]&lt;br /&gt;
[[File:Integral slg million.png]]&lt;br /&gt;
[[File:Integral sl million.png]]&lt;br /&gt;
&lt;br /&gt;
Estimating D from VACF&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586908</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586908"/>
		<updated>2017-02-22T18:08:12Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Running Integrals ===&lt;br /&gt;
&lt;br /&gt;
[[File:Integral slg.png]]&lt;br /&gt;
[[File:Integral sl.png]]&lt;br /&gt;
[[File:Integral slg million.png]]&lt;br /&gt;
[[File:Integral sl million.png]]&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_sl_million.png&amp;diff=586907</id>
		<title>File:Integral sl million.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_sl_million.png&amp;diff=586907"/>
		<updated>2017-02-22T18:07:49Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_slg_million.png&amp;diff=586904</id>
		<title>File:Integral slg million.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_slg_million.png&amp;diff=586904"/>
		<updated>2017-02-22T18:07:29Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_sl.png&amp;diff=586903</id>
		<title>File:Integral sl.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_sl.png&amp;diff=586903"/>
		<updated>2017-02-22T18:07:09Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_slg.png&amp;diff=586901</id>
		<title>File:Integral slg.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Integral_slg.png&amp;diff=586901"/>
		<updated>2017-02-22T18:06:41Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586887</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586887"/>
		<updated>2017-02-22T17:53:24Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:VACF approx.PNG|thumb|none|550px|&#039;&#039;&#039;Figure x: &#039;&#039;&#039;Plot of &amp;lt;math&amp;gt;cos(\omega\tau)&amp;lt;/math&amp;gt;, and VACF for a liquid and a solid.]]&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:VACF_approx.PNG&amp;diff=586886</id>
		<title>File:VACF approx.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:VACF_approx.PNG&amp;diff=586886"/>
		<updated>2017-02-22T17:52:00Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586810</id>
		<title>File:NpT with ideal gas.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586810"/>
		<updated>2017-02-22T15:14:11Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: Yjj14 uploaded a new version of File:NpT with ideal gas.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586809</id>
		<title>File:NpT with ideal gas.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586809"/>
		<updated>2017-02-22T15:13:22Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: Yjj14 uploaded a new version of File:NpT with ideal gas.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586806</id>
		<title>File:NpT with ideal gas.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586806"/>
		<updated>2017-02-22T15:10:34Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: Yjj14 uploaded a new version of File:NpT with ideal gas.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586805</id>
		<title>File:NpT with ideal gas.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_ideal_gas.PNG&amp;diff=586805"/>
		<updated>2017-02-22T15:09:43Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: Yjj14 uploaded a new version of File:NpT with ideal gas.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_errorbars.PNG&amp;diff=586804</id>
		<title>File:NpT with errorbars.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpT_with_errorbars.PNG&amp;diff=586804"/>
		<updated>2017-02-22T15:09:21Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: Yjj14 uploaded a new version of File:NpT with errorbars.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586668</id>
		<title>Rep:Mod:YJJ14</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YJJ14&amp;diff=586668"/>
		<updated>2017-02-22T13:16:03Z</updated>

		<summary type="html">&lt;p&gt;Yjj14: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Molecular Dynamics: Simulation of Liquids ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Velocity Verlet Equation ===&lt;br /&gt;
When applying the Velocity Verlet Equation, it is possible to achieve a good estimate of the positions and velocity of simple liquid particles by varying the timesteps. The following graphs (Figures 1-4) are plotted from data with a timestep of 0.1.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1position.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Position varying with time.]]&lt;br /&gt;
Figure 1 shows that the Velocity-Verlet Equation gives a good estimate of the positions when compared to the analytical positions of a harmonic oscillator &amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;. The coefficients &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; and&amp;lt;math&amp;gt;\Omega&amp;lt;/math&amp;gt; are set to 1 and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is set to 0.&lt;br /&gt;
[[File:0.1error.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Absolute error of between x(t) and analytical positions.]]&lt;br /&gt;
Figure 2 shows the absolute error of positions calculated from the Velocity-Verlet Equation and the positions calculated from a classical harmonic oscillator. Figure 3 shows a linear plot of the maximum absolute errors against time. It can be seen that the error is slowly increasing and should a longer period of time pass, the simulated system will less accurate.&lt;br /&gt;
&lt;br /&gt;
[[File:0.1errorlinear.PNG|500px|thumb|none|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of Maximum Absolute Error in position showing a linear trend.]]&lt;br /&gt;
&lt;br /&gt;
[[File:0.1energy.PNG|600px|thumb|none|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Total Energy from Velocity-Verlet Algorithm varying with time.]]&lt;br /&gt;
Here the total energy, &amp;lt;math&amp;gt;E_{total}=E_p+E_k&amp;lt;/math&amp;gt;, is calculated using:&amp;lt;blockquote&amp;gt;&amp;lt;math&amp;gt;E_p=\tfrac{1}{2}kx^2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;E_k=\tfrac{1}{2}mv^2&amp;lt;/math&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Where &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;m&amp;lt;/math&amp;gt; are given as 1. The values &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; are estimated with the Velocity-Verlet Equation. It is important that the fluctuation in error calculated here is small, as the total energy of a real system should not change. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To determine the timestep that is required for the total energy to have less than 1% of fluctuation, trial and error showed that the timestep to achieve small fluctuations in energy in the simulation is &#039;&#039;&#039;0.2&#039;&#039;&#039;. &amp;lt;br&amp;gt;This number is large enough so an acceptable amount of time can be run in the simulation, and is small enough so the total energy does not drastically change. It is important that the system simulated is has little change in total energy so the other properties that are measured have a physical significance.&lt;br /&gt;
&lt;br /&gt;
Graph 1, shown below, gives a range of timesteps and their associated percentage change in total energy. While Figures 5 to 8 show plots of the fluctuations of total energies for the selected timesteps.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Percentage Changes in Total Energy&lt;br /&gt;
! Timestep!! Percentage %&lt;br /&gt;
|-&lt;br /&gt;
! 0.05&lt;br /&gt;
| &amp;lt;center&amp;gt;0.06&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.10&lt;br /&gt;
| &amp;lt;center&amp;gt;0.25&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.20&lt;br /&gt;
| &amp;lt;center&amp;gt;1.00&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
! 0.25&lt;br /&gt;
| &amp;lt;center&amp;gt;1.57&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Timestep0.05.png|400px|thumb|none|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.05 ]]&lt;br /&gt;
| [[File:Timestep0.1.png|400px|thumb|none|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.10]]&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Timestep0.20.png|400px|thumb|none|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.20]] &lt;br /&gt;
|[[File:Timestep0.25.png|400px|thumb|none|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graph showing the fluctuation in total energy with a timestep of 0.25]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
==== Separation where potential energy is zero ====&lt;br /&gt;
The separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, for a single LJ interaction where the potential energy is zero is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore&amp;lt;/math&amp;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;\therefore&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt; \frac{\sigma^{6}}{r^{6}} = 1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{r_0 = \sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Force when potential energy is zero ====&lt;br /&gt;
&lt;br /&gt;
The force, &amp;lt;math&amp;gt;\mathbf{F}_i&amp;lt;/math&amp;gt;, at the separation &amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt; is given by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = \sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( \frac{\sigma^{12}}{r_{ij}^{12}} - \frac{\sigma^6}{r_{ij}^6} \right) \right\}}{\mathrm{d\mathbf{r}_i}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Differenciate wrt &amp;lt;math&amp;gt;r_i&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =  -\sum_i^N \sum_{i \neq j}^{N} \left\{ 4\epsilon \left( -\frac{12\sigma^{12}}{r_{ij}^{13}} +  \frac{6\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i =\sum_i^N \sum_{i \neq j}^{N} \left\{ 24\epsilon \left( \frac{2\sigma^{12}}{r_{ij}^{13}} -  \frac{\sigma^6}{r_{ij}^7} \right)\right\}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because &amp;lt;math&amp;gt;r_{ij} = \sigma&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;U\left(\mathbf{r}^N\right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\mathbf{F}_i = \frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Equilibrium Separation and well depth ====&lt;br /&gt;
&lt;br /&gt;
Equilibrium Separation occurs when:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}_i = - \frac{\mathrm{d}U\left(\mathbf{r}^N\right)}{\mathrm{d}\mathbf{r}_i} =  24\epsilon \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \left( \frac{2\sigma^{12}}{r^{13}} -  \frac{\sigma^6}{r^7} \right) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore  \frac{2\sigma^{12}}{r^{13}} =  \frac{\sigma^6}{r^7}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And has a value of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;r_{eq} = \sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the equilibrium distance, the well depth is found by substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; into &amp;lt;math&amp;gt;\phi \left(r\right)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\phi \left(r_{eq}\right) = -\epsilon&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Evaluating Integrals ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right) \mathrm{d}r = \int 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right) \mathrm{d}r &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::::&amp;lt;math&amp;gt; = 4\epsilon \left( \frac{\sigma^{12}}{-11r^{11}} - \frac{\sigma^6}{-5r^5} \right) + C &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r \approx -2.48 \times 10^{-2}&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 \approx -8.18 \times 10^{-3} &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 \approx -3.29 \times 10^{-3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
Realistic volumes of liquid cannot be simulated, as they involve many more particles than the usual simulated range of 1000 to 10000 particles.&lt;br /&gt;
&lt;br /&gt;
An example is to show the number of water molecules in 1 mL of water under standard conditions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1\ \mathrm{mL} = 1\ \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Number of moles in 1 mL of water: &amp;lt;math&amp;gt;\frac{1\ \mathrm{g}}{18\ \mathrm{g\ mol^{-1}} } = 5.56 \times 10^{-2}\  \mathrm{mol}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Esimated number of molecules in 1 mL of water: &amp;lt;math&amp;gt;5.56 \times 10^{-2}\ \mathrm{mol} \times 6.022 \times 10^{23}\  \mathrm{mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;=\ 3.35 \times 10^{22}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In comparison, the estimated volume of 10000 water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
Estimated volume for 10000 water molecules: &amp;lt;math&amp;gt;\frac{10000}{6.022\times 10^{23}} \times 18 = 2.99 \times 10^{-19}\ \mathrm{mL}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because the volume of simulated water is so drastically different, periodic boundary conditions are applied to better approximate a bulk liquid. This is done by pretending the simulation box is repeated infinitely in all directions, so none of the atoms in the box at the edges are exposed to a vacuum.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In a cubic box that runs from &amp;lt;math&amp;gt;(0, 0, 0)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;(1, 1, 1)&amp;lt;/math&amp;gt;. An atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; runs along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;. within one timestep it ends up at &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt; after applying periodic boundary conditions.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
It is typical when using Lennard-Jones interactions to work in reduced units, so the results are much more manageable. Reduced units are denoted by a star, and they take the following conversion factors:&lt;br /&gt;
&lt;br /&gt;
Distance &amp;lt;math&amp;gt;r^* = \frac{r}{\sigma}&amp;lt;/math&amp;gt;, Energy &amp;lt;math&amp;gt;E^* = \frac{E}{\epsilon}&amp;lt;/math&amp;gt;, Temperature &amp;lt;math&amp;gt;T^* = \frac{k_BT}{\epsilon}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\ \mathrm{nm}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt; \epsilon\ /\ k_B= 120\  \mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;r=r^*\times\sigma=3.2\times0.34&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=1.088\ \mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;T = T^* \times \frac{\epsilon}{k_B}=1.5 \times 120&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 180\ \mathrm{K}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = \frac{k_BT \times \mathrm{N_A}}{T^* \times 1000} = \frac{1.38 \times 10^{-23} \times 180 \times 6.022 \times 10^{23}}{1.5 \times 1000}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998\ \mathrm{kJ\ mol^{-1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equilibration ==&lt;br /&gt;
=== Creating the simulation box ===&lt;br /&gt;
When two atoms are given random starting coordinates, there is a probability that they will be generated very close together. This can be problematic as it would cause an infinitely high potential to form. This means that it will be difficult to equilibrate during the timescale of the simulation and so may be unable to provide any useful physical properties.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
In a simple cubic cell, if the distance between lattice points is 1.07722, the number density can be calculated as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number density} = \frac{\text{Lattice points}}{\text{Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In a simple cubic lattice, there is only 1 lattice point in a unit cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Number denisty} = \frac{1}{1.07722^3} = \frac{1}{1.25} = 0.8&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
For a face-centred lattice with a lattice point density of 1.2, the length of the unit cell is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\text {Volume of unit cell}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{Volume of unit cell} = \frac{\text{Lattice points}}{\text{Number density}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are 4 lattice points in a face centred cubic cell, therefore:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text {Length of unit cell} = \sqrt[3]{\frac{4}{1.2}}= 1.49\ 3sf&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
With a face-centred cubic lattice, create_atoms command would create 4 times as many atoms in a box than when using a simple cubic lattice.&lt;br /&gt;
&lt;br /&gt;
=== Setting the properties of the atoms ===&lt;br /&gt;
&lt;br /&gt;
The purpose of the following commands in the input script can be found using the LAMMPS manual.&lt;br /&gt;
&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;
&lt;br /&gt;
 mass 1 1.0 &lt;br /&gt;
This command means that you are defining the mass of the atoms. With a type 1 and with a mass of 1.0 in reduced units&lt;br /&gt;
&lt;br /&gt;
 pair_style lj/cut 3.0&lt;br /&gt;
This command means that your are simulating paired interactions using a Lennard-Jones potential and cutting off at a distance of 3.0&lt;br /&gt;
&lt;br /&gt;
 pair_coeff * * 1.0 1.0&lt;br /&gt;
This command defines some of the other coefficients for the simulation. The asterisks correspond to two atoms of any type. The numbers at the end correspond to thecoefficients &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
As we have specified &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;, the integration algorithm that we can use is the Velocity-Verlet Algorithm as it will update the position each timestep and the velocity each half-step.&lt;br /&gt;
&lt;br /&gt;
=== Running the simulation ===&lt;br /&gt;
&lt;br /&gt;
Figure 9 shows two different formats of command that should both run 100000 steps during a simulation. &lt;br /&gt;
&lt;br /&gt;
{| class=&#039;wikitable&#039;&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;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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;
|colspan=2|&#039;&#039;&#039;Figure 9: &#039;&#039;&#039; Two different formats of command that should achieve the same output.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The command on the left can easily change the number of steps that it will take during a simulation for a certain timestep.&lt;br /&gt;
&lt;br /&gt;
For example, this specific command shows that a timestep of 0.001 would run 100000 steps. If the timestep was changed to 0.01, the code would automatically calculate the number of steps to be 10000. Both timesteps will eventually run for a total time of 100. This cannot be achieved for the command on the right.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibrium ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[file:Totalenergy_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 10: &#039;&#039;&#039;Graph of total energy against time, timestep: 0.001]]&lt;br /&gt;
|[[file:Temperature_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 11: &#039;&#039;&#039;Graph of temperature against time, timestep: 0.001]]&lt;br /&gt;
|-&lt;br /&gt;
|[[file:Pressure_t_0.001.png|500px|thumb|&#039;&#039;&#039;Figure 12: &#039;&#039;&#039;Graph of pressure against time, timestep: 0.001]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Figures 10, 11 and 12 show that equilibrium is reached very rapidly.&lt;br /&gt;
* For Total Energy this takes a time of approx: 0.14&lt;br /&gt;
* For Temperature this takes a time of approx: 0.30&lt;br /&gt;
* For Pressure this takes a time of approx: 0.40&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Figure 13 shows a graph of all the total energies for all the simulated timesteps, 0.001, 0.0025, 0.0075, 0.01 and 0.015.&lt;br /&gt;
[[File:total_energy_varying_timesteps.png|1000px|thumb|none|&#039;&#039;&#039;Figure 13: &#039;&#039;&#039; Graph of the total energies for the timesteps: 0.001, 0.0025, 0.0075, 0.01 and 0.015.]]&lt;br /&gt;
&lt;br /&gt;
From these timesteps, it can be seen that the largest timestep that still gives acceptable results is the timestep of 0.01.&lt;br /&gt;
The worst results occur from the timestep of 0.015, as the total energy simulated from this timestep increases linearly after a short attempt at equilibrating.&lt;br /&gt;
&lt;br /&gt;
However the best timestep to use for future simulations would probably be 0.0025. This timestep achieves the lowest equilibrated energy along with the timestep 0.001.  A timestep of 0.0025 would be better because it can simulate for a longer period of time than 0.001, with the best balance.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions==&lt;br /&gt;
&lt;br /&gt;
INSERT SOME THEORY HERE AND STATE THE pT parameters used.&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
&lt;br /&gt;
To get the target temperature, each velocity will have to by multiplied by the constant factor, &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. &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;
Multiply each velocity by &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \gamma^2 v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;, substituting this into the equation gives:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 \frac{1}{2}\sum_i m_i  v_i^2 =\gamma^2 \frac{3}{2} N k_BT= \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be simplified and rearranged to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 T= \mathfrak{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;
Therefore&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\gamma = \pm\sqrt{ \frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examing the Input Script ===&lt;br /&gt;
&amp;lt;pre&amp;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&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The three number 100, 1000 and 100000 are the arguments for &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; respectively. They determine what timesteps the input values will be used in the average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;&#039;&#039;&#039;: Number of timesteps between every input number that will be used in the calculation of an average.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt;&#039;&#039;&#039;: This number refers determines how many input values are averaged. The input values used are the timesteps &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; before the &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt;&#039;&#039;&#039;: The multiples of this value of timestep is when averages are calculated.&lt;br /&gt;
&lt;br /&gt;
Ex: For the values &amp;lt;i&amp;gt;Nevery&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;Nrepeat&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;Nfreq&amp;lt;/i&amp;gt; as 100, 1000 and 100000...&lt;br /&gt;
:*When nearing timestep = 100000&lt;br /&gt;
&lt;br /&gt;
:*100, 200, 300, 400... 5400, 5500, 5600 ... 99700, 99800, 99900, 100000&lt;br /&gt;
:*These numbers are 100 timesteps apart from each other. They are the previous 1000 repeats of this timestep which preceded the timestep 100000 when an average is calculated.&lt;br /&gt;
&lt;br /&gt;
This repeats again from 100100 to 200000 where another average of a different set of 1000 values will be calculated.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This then means that in this simulation the values such as temperature will be sampled every 100 timesteps. While for the duration of the 100000 timestep simulation, 1000 measurements will contribute to the average.&lt;br /&gt;
&lt;br /&gt;
Finally the total time that is simulated is: number of steps multiplied by the chosen timestep for the simulation.&amp;lt;br&amp;gt;&amp;lt;math&amp;gt;100000 \times 0.0025 = 250&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
&lt;br /&gt;
TASK: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated. &lt;br /&gt;
&lt;br /&gt;
Your graph(s) should include error bars in both the x and y directions. &lt;br /&gt;
&lt;br /&gt;
[[File:NpT with errorbars.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 14: &#039;&#039;&#039; A plot of Density against Reduced Temperature.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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?&lt;br /&gt;
[[File:NpT with ideal gas.PNG|thumb|none|700px|&#039;&#039;&#039;Figure 15: &#039;&#039;&#039; A Density-Temperature Plot with the predicted densities of an ideal gas at the same pressures.]]&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
&lt;br /&gt;
TASK: As in the last section, you need to run simulations at ten phase points. &lt;br /&gt;
&lt;br /&gt;
In this section, the density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space was explored. Two densities at 0.2 and 0.8, and a temperature range of 2.0, 2.2, 2.4, 2.6, 2.8 was simulated. This gave &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where V is the volume of the simulation cell, for both of the densities. &lt;br /&gt;
&lt;br /&gt;
[[File:NVT Heat Capacity Volume Temperature.PNG|thumb|none|600px|&#039;&#039;&#039;Figure 16: &#039;&#039;&#039;Plot of &amp;lt;big&amp;gt;&amp;lt;sup&amp;gt;C&amp;lt;sub&amp;gt;v&amp;lt;/sub&amp;gt;&amp;lt;/sup&amp;gt;/&amp;lt;sub&amp;gt;V&amp;lt;/sub&amp;gt;&amp;lt;/big&amp;gt; against reduced temperature for two different densities.]]&lt;br /&gt;
&lt;br /&gt;
Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \frac{3}{2}R&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;### SET DENSITY OF LATTICE ###&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
### DEFINE SIMULATION BOX GEOMETRY ###&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
### DEFINE PHYSICAL PROPERTIES OF ATOMS ###&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
### SPECIFY THE REQUIRED THERMODYNAMIC STATE ###&lt;br /&gt;
variable T equal 2.0&lt;br /&gt;
variable timestep equal 0.0025&lt;br /&gt;
&lt;br /&gt;
### ASSIGN ATOMIC VELOCITIES ###&lt;br /&gt;
velocity all create ${T} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
### SPECIFY ENSEMBLE ###&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
### THERMODYNAMIC OUTPUT CONTROL ###&lt;br /&gt;
thermo_style custom time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
### RECORD TRAJECTORY ###&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION TO MELT CRYSTAL ###&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### BRING SYSTEM TO REQUIRED STATE ###&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${T} ${T} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
### MEASURE SYSTEM STATE ###&lt;br /&gt;
thermo_style custom step etotal temp atoms vol&lt;br /&gt;
variable energy equal etotal&lt;br /&gt;
variable energy2 equal etotal*etotal&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable n equal atoms&lt;br /&gt;
variable n2 equal atoms*atoms&lt;br /&gt;
variable vol equal vol&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_energy v_energy2 v_temp v_temp2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable ave_energy equal f_aves[1]&lt;br /&gt;
variable ave_energy2 equal f_aves[2]&lt;br /&gt;
variable ave_temp equal f_aves[3]&lt;br /&gt;
variable ave_temp2 equal f_aves[4]&lt;br /&gt;
variable cv equal ${n2}*(${ave_energy2}-${ave_energy}*${ave_energy})/(${ave_temp}*${ave_temp})&lt;br /&gt;
variable cv_v equal ${cv}/${vol}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
print “Variables&amp;quot;&lt;br /&gt;
print &amp;quot;Temperature: ${ave_temp}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv: ${cv}&amp;quot;&lt;br /&gt;
print &amp;quot;Cv/V : ${cv_v}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
&lt;br /&gt;
Simulations of Lennard-Jones potentials for the three different phases solid, liquid and a gas were performed. The &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; were plotted against distance and are shown in Figure X and X.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Rdf gr slg.PNG|thumb|570px|&#039;&#039;&#039;Figure 17: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|[[File:Rdf int(gr) sgl.PNG|thumb|540px|&#039;&#039;&#039;Figure 18: &#039;&#039;&#039;RDF of a solid, liquid and gas.]]&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first three peaks in the RDF for a solid correspond to the first three nearest neighbours in the lattice. This is shown in Figure X where some of the nearest neighbour relationships are labelled.&lt;br /&gt;
[[File:Solid fcc neighbours.png|thumb|none|500px|&#039;&#039;&#039;Figure 19: &#039;&#039;&#039; FCC lattice, showing the 1st, 2nd and 3rd nearest neighbours.]]&lt;br /&gt;
&lt;br /&gt;
The lattice spacing in the solid system is the distance between the reference atom and the 2nd nearest neighbour.&amp;lt;br&amp;gt;For a simulation where the density of the system is 1.5 with a temperature of 1.2: the lattice spacing &#039;&#039;&#039;a&#039;&#039;&#039; is 1.375.&lt;br /&gt;
&lt;br /&gt;
The coordination number of the first three peaks are:&lt;br /&gt;
&lt;br /&gt;
*12 for the first peak and the first nearest neighbour.&lt;br /&gt;
*6 for the second peak and the second nearest neighbour.&lt;br /&gt;
*24 for the third peak and the third nearest neighbour.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
The mean squared displacement is a measure of the deviation time between the position of a particle and some reference position.&lt;br /&gt;
&lt;br /&gt;
Figure 20 shows a plot of the &#039;&#039;&#039;total mean squared displacement against timestep&#039;&#039;&#039; for the three different phases: a vapour phase, a liquid phase and a solid phase.&amp;lt;br&amp;gt;&lt;br /&gt;
It can be seen that displacement occurs significantly faster for the vapour phase than the liquid or solid phases.&lt;br /&gt;
&lt;br /&gt;
Since the mean squared displacement by time, &amp;lt;math&amp;gt;\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; has already been plotted. The diffusion coefficient can be estimated by extrapolating the linear regions of each line and dividing through by 6 because: &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 values of D are shown in Table 2 below. As expected a vapour phase has the largest diffusion coefficient and is significantly large than the diffusion coefficients for liquid and solid phases.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Total MSD slg.PNG|thumb|none|570px|&#039;&#039;&#039;Figure 20: &#039;&#039;&#039;A plot of total mean squared displacement against timestep]]||[[File:Million MSD slg.PNG|thumb|none|645px|&#039;&#039;&#039;Figure 21: &#039;&#039;&#039; A plot of total mean squared displacement against timestep for a simulation of one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&#039;wikitable&#039;&lt;br /&gt;
|+ Values of D for the two simulations of mean squared displacement against time&lt;br /&gt;
!Phase&lt;br /&gt;
!D (Area/time) - MSD&lt;br /&gt;
!D (Area/time) - MSD (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
!Vapour&lt;br /&gt;
|6.05&lt;br /&gt;
|3.18&lt;br /&gt;
|-&lt;br /&gt;
!Liquid&lt;br /&gt;
|8.49 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|8.72 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
!Solid&lt;br /&gt;
|7.20 x 10&amp;lt;sup&amp;gt;-7&amp;lt;/sup&amp;gt;&lt;br /&gt;
|4.39 x 10&amp;lt;sup&amp;gt;-6&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
The Velocity Autocorrelation Function is:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \left\langle \mathbf{v}\left(t\right) \cdot \mathbf{v}\left(t+\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator.&lt;br /&gt;
&lt;br /&gt;
A 1D harmonic oscillator:&lt;br /&gt;
:&amp;lt;math&amp;gt;x\left(t\right) = A\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;v(t) = \frac{dx(t)}{dt} = -A\omega \sin\left(\omega t + \phi\right) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substitute into the equation for a normalised velocity autocorrelation function: &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;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \left(-A\omega \sin\left(\omega t + \phi\right)\right)\times\left(-A\omega \sin\left(\omega (t+\tau) + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} (-A\omega \sin\left(\omega t + \phi\right))^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} A\omega \sin\left(\omega t + \phi\right)\times A\omega \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{\int_{-\infty}^{\infty} A^2\omega^2 \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{A^2\omega^2  \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right)\ \mathrm{d}t}{A^2\omega^2 \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty} \sin\left(\omega t + \phi\right)\times \sin\left(\omega t+\omega \tau + \phi\right) \ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using double angle formula: &amp;lt;math&amp;gt;\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin(\omega t+ \phi + \omega\tau  ) = \sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\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}  \sin\left(\omega t + \phi\right) \times[\sin (\omega t+\phi) \cos \omega \tau + \cos (\omega t +\phi)\sin \omega\tau]\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right) \cos \omega \tau + \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\sin \omega\tau\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The constants &amp;lt;math&amp;gt;\cos\omega\tau&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\omega\tau&amp;lt;/math&amp;gt; can be moved to the front.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t + \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\cos \omega \tau  \int_{-\infty}^{\infty}  \sin^2 \left(\omega t + \phi \right) \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t} + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \cos\omega\tau + \frac{\sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t}{ \int_{-\infty}^{\infty}  \sin^2\left(\omega t + \phi\right)  \mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, evaluate the integrals as odd and even functions.&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt;sin(x)cos(x)&amp;lt;/math&amp;gt; is an odd function, and integrating an odd function between equal limits = 0.&amp;lt;br&amp;gt;The numerator on the right hand side becomes &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \sin \omega\tau \int_{-\infty}^{\infty}  \sin\left(\omega t + \phi\right)\cos (\omega t +\phi)\ \mathrm{d}t = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau + 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \cos\omega\tau&amp;lt;/math&amp;gt;&amp;lt;/center&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yjj14</name></author>
	</entry>
</feed>