<?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=Az1114</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=Az1114"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Az1114"/>
	<updated>2026-08-10T19:09:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583421</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583421"/>
		<updated>2017-02-10T11:27:32Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png|thumb|600px|none]] [[File:Temperatureaz.png|thumb|600px|none]] [[File:Pressureaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
==Heat Capacity Calculations==&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no long-range order. They also exhibit rotational and to some extent translational motion. Then gases have the most freedom of all states, having a much larger translational motion.&lt;br /&gt;
&lt;br /&gt;
From the RDF graph it can be seen that the solid function has a very distinct function with peaks and troughs. This is due to its atoms being fixed into a lattice with long-range order. For the liquid, there is a few peaks and troughs, representing the short range order of particles immediately surrounding the central particle, then averaging out to 1 - the system density. For the gaseous phase, the curve very quickly tends to the average value of 1, as there is no short- or long-range order in this phase.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
From the curve for the solid the first 3 peaks at increasing distance can be attributed to the different lattice points in the fcc lattice about the original atom. For an atom on the corner of a cube, the 3 distances represent an atom at an adjacent vertex, an adjacent face, and an opposing face. These occur at a reduced distance of 1.06, 1.48 and 1.83 respectively. These agree with the distances noted on the graph. The coordination number can be deduced from the running integral of the curve and for the 3 peaks are given by 11, 6 &amp;amp; 24 respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;br /&gt;
&lt;br /&gt;
[[File:runningintegralaz.png]]&lt;br /&gt;
&lt;br /&gt;
The values for D from the VCAF model were greater in magnitude than those from the MSD calculations. The greatest source of error is most likely to be the use of the trapezium rule instead of an exact integral of each function.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Different_Timesteps.png&amp;diff=583419</id>
		<title>File:Different Timesteps.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Different_Timesteps.png&amp;diff=583419"/>
		<updated>2017-02-10T11:27:03Z</updated>

		<summary type="html">&lt;p&gt;Az1114: Az1114 uploaded a new version of File:Different Timesteps.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Graph of Total energy versus time for different timesteps of simulation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583413</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583413"/>
		<updated>2017-02-10T11:23:34Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png|thumb|600px|none]]] [[File:Temperatureaz.png|thumb|600px|none]]] [[File:Pressureaz.png|thumb|600px|none]]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png|thumb|600px|none]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
==Heat Capacity Calculations==&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no long-range order. They also exhibit rotational and to some extent translational motion. Then gases have the most freedom of all states, having a much larger translational motion.&lt;br /&gt;
&lt;br /&gt;
From the RDF graph it can be seen that the solid function has a very distinct function with peaks and troughs. This is due to its atoms being fixed into a lattice with long-range order. For the liquid, there is a few peaks and troughs, representing the short range order of particles immediately surrounding the central particle, then averaging out to 1 - the system density. For the gaseous phase, the curve very quickly tends to the average value of 1, as there is no short- or long-range order in this phase.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
From the curve for the solid the first 3 peaks at increasing distance can be attributed to the different lattice points in the fcc lattice about the original atom. For an atom on the corner of a cube, the 3 distances represent an atom at an adjacent vertex, an adjacent face, and an opposing face. These occur at a reduced distance of 1.06, 1.48 and 1.83 respectively. These agree with the distances noted on the graph. The coordination number can be deduced from the running integral of the curve and for the 3 peaks are given by 11, 6 &amp;amp; 24 respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;br /&gt;
&lt;br /&gt;
[[File:runningintegralaz.png]]&lt;br /&gt;
&lt;br /&gt;
The values for D from the VCAF model were greater in magnitude than those from the MSD calculations. The greatest source of error is most likely to be the use of the trapezium rule instead of an exact integral of each function.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Pressureaz.png&amp;diff=583412</id>
		<title>File:Pressureaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Pressureaz.png&amp;diff=583412"/>
		<updated>2017-02-10T11:22:35Z</updated>

		<summary type="html">&lt;p&gt;Az1114: Az1114 uploaded a new version of File:Pressureaz.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Temperatureaz.png&amp;diff=583410</id>
		<title>File:Temperatureaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Temperatureaz.png&amp;diff=583410"/>
		<updated>2017-02-10T11:22:07Z</updated>

		<summary type="html">&lt;p&gt;Az1114: Az1114 uploaded a new version of File:Temperatureaz.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Total_Energyaz.png&amp;diff=583409</id>
		<title>File:Total Energyaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Total_Energyaz.png&amp;diff=583409"/>
		<updated>2017-02-10T11:21:20Z</updated>

		<summary type="html">&lt;p&gt;Az1114: Az1114 uploaded a new version of File:Total Energyaz.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:MSD1az.jpg&amp;diff=583393</id>
		<title>File:MSD1az.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:MSD1az.jpg&amp;diff=583393"/>
		<updated>2017-02-10T11:14:57Z</updated>

		<summary type="html">&lt;p&gt;Az1114: Az1114 uploaded a new version of File:MSD1az.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583386</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583386"/>
		<updated>2017-02-10T11:07:19Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Radial Distribution Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
==Heat Capacity Calculations==&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no long-range order. They also exhibit rotational and to some extent translational motion. Then gases have the most freedom of all states, having a much larger translational motion.&lt;br /&gt;
&lt;br /&gt;
From the RDF graph it can be seen that the solid function has a very distinct function with peaks and troughs. This is due to its atoms being fixed into a lattice with long-range order. For the liquid, there is a few peaks and troughs, representing the short range order of particles immediately surrounding the central particle, then averaging out to 1 - the system density. For the gaseous phase, the curve very quickly tends to the average value of 1, as there is no short- or long-range order in this phase.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
From the curve for the solid the first 3 peaks at increasing distance can be attributed to the different lattice points in the fcc lattice about the original atom. For an atom on the corner of a cube, the 3 distances represent an atom at an adjacent vertex, an adjacent face, and an opposing face. These occur at a reduced distance of 1.06, 1.48 and 1.83 respectively. These agree with the distances noted on the graph. The coordination number can be deduced from the running integral of the curve and for the 3 peaks are given by 11, 6 &amp;amp; 24 respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;br /&gt;
&lt;br /&gt;
[[File:runningintegralaz.png]]&lt;br /&gt;
&lt;br /&gt;
The values for D from the VCAF model were greater in magnitude than those from the MSD calculations. The greatest source of error is most likely to be the use of the trapezium rule instead of an exact integral of each function.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583374</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583374"/>
		<updated>2017-02-10T10:58:49Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Radial Distribution Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
==Heat Capacity Calculations==&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no long-range order. They also exhibit rotational and to some extent translational motion. Then gases have the most freedom of all states, having a much larger translational motion.&lt;br /&gt;
&lt;br /&gt;
From the RDF graph it can be seen that the solid function has a very distinct function with peaks and troughs. This is due to its atoms being fixed into a lattice with long-range order. For the liquid, there is a few peaks and troughs, representing the short range order of particles immediately surrounding the central particle, then averaging out to 1 - the system density. For the gaseous phase, the curve very quickly tends to the average value of 1, as there is no short- or long-range order in this phase.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;br /&gt;
&lt;br /&gt;
[[File:runningintegralaz.png]]&lt;br /&gt;
&lt;br /&gt;
The values for D from the VCAF model were greater in magnitude than those from the MSD calculations. The greatest source of error is most likely to be the use of the trapezium rule instead of an exact integral of each function.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583368</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583368"/>
		<updated>2017-02-10T10:53:13Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
==Heat Capacity Calculations==&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;br /&gt;
&lt;br /&gt;
[[File:runningintegralaz.png]]&lt;br /&gt;
&lt;br /&gt;
The values for D from the VCAF model were greater in magnitude than those from the MSD calculations. The greatest source of error is most likely to be the use of the trapezium rule instead of an exact integral of each function.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583364</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583364"/>
		<updated>2017-02-10T10:48:26Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
==Heat Capacity Calculations==&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpTaz.png&amp;diff=583360</id>
		<title>File:NpTaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NpTaz.png&amp;diff=583360"/>
		<updated>2017-02-10T10:46:48Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583359</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583359"/>
		<updated>2017-02-10T10:46:34Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Explaining the Input Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025.&lt;br /&gt;
&lt;br /&gt;
===Equations of State===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:NpTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The above graph is a plot of the density versus temperature of the system for a liquid at two different pressures. There are plots for the values calculated from the simulation and from the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
There is a large difference between the simulated and ideal values, to an extent that they are much larger than the standard error of the simulated values, meaning the y-axis error bars are not visible. However they both follow a trend of the density decreasing with temperature, which follows the theory of thermal expansion.&lt;br /&gt;
&lt;br /&gt;
A reason for the discrepancy will be due to the nature of the ideal gas law ignoring all interactions between particles, whereas in the simulation there is some Leonard Jones force, which when acting repulsively can push atoms further apart, resulting in a lower simulated density than in the ideal gas law.&lt;br /&gt;
Also note that the interactions in liquids are much greater than the interactions in gases, and so to use the ideal gas law for a liquid can quickly become a very crude approximation.&lt;br /&gt;
&lt;br /&gt;
===Heat Capacity Calculations===&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:NVTaz.png&amp;diff=583353</id>
		<title>File:NVTaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:NVTaz.png&amp;diff=583353"/>
		<updated>2017-02-10T10:38:54Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583352</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583352"/>
		<updated>2017-02-10T10:38:32Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Heat Capacity Calculations===&lt;br /&gt;
The heat capacity to volume ratio versus temperature is plotted below. Theoretically, heat capacity will decrease with increasing temperature and increase with respect to increasing density, as there will be more molecules per unit volume that needs to increase in energy.&lt;br /&gt;
&lt;br /&gt;
[[File:NVTaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583325</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583325"/>
		<updated>2017-02-10T10:16:05Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Periodic Boundary Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, the number of molecules in 1 mL of water is given by:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conversely, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all directions, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583323</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583323"/>
		<updated>2017-02-10T10:14:33Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.5 \times 10^{-6}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;2.38&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.35&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:VACFaz.png&amp;diff=583310</id>
		<title>File:VACFaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:VACFaz.png&amp;diff=583310"/>
		<updated>2017-02-10T10:06:58Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583309</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583309"/>
		<updated>2017-02-10T10:06:34Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACFaz.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583298</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583298"/>
		<updated>2017-02-10T09:47:16Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator===&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583297</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583297"/>
		<updated>2017-02-10T09:47:04Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===Velocity-Verlot Algorithm versus the Harmonic Oscillator&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583296</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583296"/>
		<updated>2017-02-10T09:46:02Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583295</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583295"/>
		<updated>2017-02-10T09:45:33Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583294</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583294"/>
		<updated>2017-02-10T09:42:58Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583293</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583293"/>
		<updated>2017-02-10T09:42:31Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583292</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583292"/>
		<updated>2017-02-10T09:41:46Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583291</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583291"/>
		<updated>2017-02-10T09:41:12Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
&lt;br /&gt;
[[File:Displacementaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Erroraz.png&amp;diff=583290</id>
		<title>File:Erroraz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Erroraz.png&amp;diff=583290"/>
		<updated>2017-02-10T09:40:01Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Energyintroaz.png&amp;diff=583289</id>
		<title>File:Energyintroaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Energyintroaz.png&amp;diff=583289"/>
		<updated>2017-02-10T09:39:17Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Displacementaz.png&amp;diff=583288</id>
		<title>File:Displacementaz.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Displacementaz.png&amp;diff=583288"/>
		<updated>2017-02-10T09:38:34Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583287</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583287"/>
		<updated>2017-02-10T09:38:17Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below in the two figures are the graphs for displacement and energy versus time of a classical harmonic oscillator compared to the values given by the velocity-Verlet algorithm. Both graphs are set at a timestep of 0.1, and it can be seen that for the displacement there is no significant deviation between the displacement of the two different methods.&lt;br /&gt;
[[File:Displacementaz.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Energyintroaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following graph is the error of the velocity-Verlot alorithm, or more specifically the absolute difference between the two methods versus time. Note that the value of error oscillates with time between 0 and a maximum, with the maximum generally increasing. The error maximum is found when displacement is zero, thus when at a velocity maximum.&lt;br /&gt;
&lt;br /&gt;
[[File:Erroraz.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A range of timesteps were used to find what is optimal, from 0.001 to 0.015. It was found that with higher timestep the error with displacement (and therefore energy) increased too. The total error of 1% was not crossed with the timesteps used, but it can be extrapolated to be around a timestep of 0.2&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Timestep&lt;br /&gt;
!Error in Displacement (absolute values)&lt;br /&gt;
|-&lt;br /&gt;
|0.01&lt;br /&gt;
|0.000006&lt;br /&gt;
|-&lt;br /&gt;
|0.05&lt;br /&gt;
|0.0005&lt;br /&gt;
|-&lt;br /&gt;
|0.075&lt;br /&gt;
|0.002&lt;br /&gt;
|-&lt;br /&gt;
|0.1&lt;br /&gt;
|0.005&lt;br /&gt;
|-&lt;br /&gt;
|0.15&lt;br /&gt;
|0.08&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583116</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583116"/>
		<updated>2017-02-10T04:27:03Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is odd.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
From the graph note that the liquid VACF tends quickly to zero, and the solid has small fluctuations. The difference arises as the in the liquid phase the particles have more translational freedom and can collide, exchanging energy between particles. Solid phase atoms retain a relatively static position around their equilibrium position. Also the solid rate will decay slower than in liquids.&lt;br /&gt;
&lt;br /&gt;
For the harmonic oscillator, the VACF will not decay to zero as the there are atoms exchanging with their neighbours, which do not occur in harmonic oscillation.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583106</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583106"/>
		<updated>2017-02-10T04:16:46Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Starting from a 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, using the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant, thus &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583104</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583104"/>
		<updated>2017-02-10T04:14:45Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Mean Squared Displacement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583098</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583098"/>
		<updated>2017-02-10T03:59:17Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.098&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583097</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583097"/>
		<updated>2017-02-10T03:58:50Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;8.96 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.0979&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583096</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583096"/>
		<updated>2017-02-10T03:58:25Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;0.896 \times 10^{-4}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.085&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.089&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.0979&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.090&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583094</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583094"/>
		<updated>2017-02-10T03:55:42Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Dynamical Properties and the Diffusion Coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! State !! From MSD (thousand atoms) !! From MSD (million) !! From VCAF (thousand atoms) !! From VCAF (million)&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;0.000896&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.0855&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.0892&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.0979&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:RDFaz.jpg&amp;diff=583092</id>
		<title>File:RDFaz.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:RDFaz.jpg&amp;diff=583092"/>
		<updated>2017-02-10T03:52:29Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:MSD2az.jpgthumb&amp;diff=583085</id>
		<title>File:MSD2az.jpgthumb</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:MSD2az.jpgthumb&amp;diff=583085"/>
		<updated>2017-02-10T03:46:08Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:MSD1az.jpg&amp;diff=583084</id>
		<title>File:MSD1az.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:MSD1az.jpg&amp;diff=583084"/>
		<updated>2017-02-10T03:44:14Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583082</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583082"/>
		<updated>2017-02-10T03:43:39Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Mean Squared Displacement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! Phase !! From MSD !! From MSD (million atoms) !! From VCAF !! From VCAF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.0855&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.0892&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.0979&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;0.000896&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD1az.jpg|thumb|600px|none]][[File:MSD2az.jpgthumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
From the graphs it can be concluded that the final 1000 timesteps follow linearity with which to apply the equations, and thus the diffusion coefficients can be calculated from the last timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583074</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=583074"/>
		<updated>2017-02-10T03:37:10Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
The Diffusion Coefficients &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; of a simulated gas, liquid and solid were calculated using several different methods:&lt;br /&gt;
&lt;br /&gt;
1) From the Mean Squared Displacement (MSD) of 8,000 simulated atoms, according to the equation &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;
2) From the MSD of a million atoms&lt;br /&gt;
&lt;br /&gt;
3) From the Velocity Autocorrelation Function (VACF), by integration.&lt;br /&gt;
&lt;br /&gt;
4) From the VACF of a million atoms&lt;br /&gt;
&lt;br /&gt;
The results were as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Diffusion Coefficients (unit area/unit time)&lt;br /&gt;
! Phase !! From MSD !! From MSD (million atoms) !! From VCAF !! From VCAF (million atoms)&lt;br /&gt;
|-&lt;br /&gt;
| Gas || &amp;lt;math&amp;gt;6.05&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.22&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;6.32&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;3.27&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Liquid || &amp;lt;math&amp;gt;0.0855&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.0892&amp;lt;/math&amp;gt; ||&amp;lt;math&amp;gt;0.0979&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;0.09&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Solid || &amp;lt;math&amp;gt;0.000896&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;1.5 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;-1.66 \times 10^{-5}&amp;lt;/math&amp;gt; || &amp;lt;math&amp;gt;4.55\times 10^{-5}&amp;lt;/math&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We can see from the table that the diffusion coefficients calculated from the same number of atoms agree very well with each other, which suggests that the results are quite precise. However, we can assume that the million atoms simulations inevitably provide more accurate data.&lt;br /&gt;
&lt;br /&gt;
The results also make sense logically, where the gas have the highest diffusion coefficient (they are able to diffuse much faster) than the liquid, and the diffusion coefficient of the solid is close to 0.&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- The Mean Squared Displacement can be used to find the Diffusion Coefficient, &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;, via the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Plotting the mean squared displacement (MSD) against time, then finding the linear gradient would give us the diffusion coefficient &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt;. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:MSD-SHL.png|thumb|600px|none]][[File:MSD Mill SHL.png|thumb|600px|none]]&lt;br /&gt;
&lt;br /&gt;
Graphical analysis showed that the last 1,000 timesteps are suitably linear to apply this equation, and the Diffusion Coefficients for the three different phases were found from the last 1,000 timesteps.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the 1D Harmonic Oscillator:&lt;br /&gt;
&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;
&lt;br /&gt;
Differentiating this gives the velocity function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; v\left(t\right) = -A\omega \sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting this into the integrated form of the VAFC:&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) \cdot A \omega \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(A \omega \sin\left(\omega t + \phi\right)\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} \sin\left(\omega t + \phi \right) \cdot \sin \left(\omega \left(t+\tau\right)+\phi\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\right)^2\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the trigonometric identity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin \left(\alpha + \beta \right)= \sin\alpha\cos\beta + \sin\beta\cos\alpha,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sin\left(\omega t + \phi + \omega\tau\right) = \sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} \sin\left(\omega t + \phi \right) \cdot \left(\sin\left(\omega t+\phi\right)\cos\left(\omega\tau\right) + \sin\left(\omega\tau\right)\cos\left(\omega t + \phi\right)\right)\mathrm{d}t}{\int_{-\infty}^{\infty} \left(\sin\left(\omega t + \phi\right)\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} \sin^2\left(\omega t + \phi\right)\cos\left(\omega \tau\right) + \int_{-\infty}^{\infty} \sin \left(\omega \tau\right) \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; is a constant so &amp;lt;math&amp;gt;\cos\left(\omega\tau\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sin\left(\omega\tau\right)&amp;lt;/math&amp;gt; can be taken out of the integral.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\frac{\cos\left(\omega \tau\right)\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right) + \sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; can cancel out:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since &amp;lt;math&amp;gt;\sin(x)&amp;lt;/math&amp;gt; is an odd function and &amp;lt;math&amp;gt;\cos(x)&amp;lt;/math&amp;gt; is an even function, &amp;lt;math&amp;gt;\sin(x)\cos(x)&amp;lt;/math&amp;gt; is an odd function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; is an odd function (While the value of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; can change whether or not the functions are even or odd, it shifts both functions by the same amount and the resulting &amp;lt;math&amp;gt;\cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)&amp;lt;/math&amp;gt; will still be odd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)=0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\therefore C\left(\tau\right)=\cos\left(\omega \tau\right)+\frac{\sin \left(\omega \tau\right) \int_{-\infty}^{\infty} \cos \left(\omega t + \phi\right)\sin\left(\omega t + \phi\right)}{\int_{-\infty}^{\infty} \sin^2\left(\omega t + \phi\right)}=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right)=\cos\left(\omega \tau\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:VACF-SHL.png|thumb|800px|Comparison of Normalised VACF with VACF of Liquid and Solid|left]]&lt;br /&gt;
&lt;br /&gt;
We can see from this graph that while the VACF of the liquid quickly decorrelates to 0, the solid still retains some minor fluctuations. This is due to the fact that the atoms in a liquid are more free to move around and collide with each other, &amp;quot;forgetting&amp;quot; what its initial velocity was from exchanging energy, whereas for atoms in the solid state, they are already in a relatively stable position (similar to &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; in L-J interactions) and oscillate about 0. Eventually, atoms in solids, too, will decay, but at a much slower rate than in liquids.&lt;br /&gt;
&lt;br /&gt;
The VACF for the harmonic oscillator does not decay at all since the decorrelation arises from the atoms exchanging energy with their neighbours, which does not occur in harmonic oscillators.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=582485</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=582485"/>
		<updated>2017-02-09T16:50:42Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Radial Distribution Functions==&lt;br /&gt;
&lt;br /&gt;
The radial distribution functions of a Leonard-Jones system in the solid, liquid and gas phase are distinctly different. This is due to the degrees of freedom that exist in each particular phase. In the solid phase, all the atoms are locked into a lattice structure, having only vibrational motion, with both long-range and short range order.&lt;br /&gt;
&lt;br /&gt;
Liquids have more degrees of freedom, with no short-range order. They also exhibit rotational and to some extent translational motion.&lt;br /&gt;
&lt;br /&gt;
[[File:RDFaz.jpg]]&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=581178</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=581178"/>
		<updated>2017-02-07T19:32:46Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Plotting the equations of state===&lt;br /&gt;
[[File:Densityaz]]&lt;br /&gt;
&lt;br /&gt;
The above graph displays the density (both ideal and from the simulation) versus temperature.&lt;br /&gt;
&lt;br /&gt;
Note that there is a significant discrepancy between simulation and theory, the theoretical being greater in magnitude. The error bars cannot be seen in the graph as the difference between the ideal and simulated densities is so high that the error bars become too small to visualise.&lt;br /&gt;
&lt;br /&gt;
Factors leading to this discrepancy may involve the model of the Leonard-Jones interaction in the simulation. The ideal gas law relies on there being no inter-particle interaction, and thus if there is a repulsive force due to the Leonard-Jones interactions, then the density may be lower than the ideal calculation.&lt;br /&gt;
&lt;br /&gt;
It can also be seen that as the temperature increases, the discrepancy between the ideal and simulated densities becomes smaller.&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580473</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580473"/>
		<updated>2017-02-06T12:20:15Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explaining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
In order to calculate the average values for our simulation, the following parameters are set in the input script.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time Nevery Nrepeat Nfreq&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that final averages are calculated only on timesteps that are multiples of Nevery, Nrepeat times; and an average is generated every Nfreq timesteps.&lt;br /&gt;
&lt;br /&gt;
The following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fix aves all ave/time 100 1000 100000&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Means that the results will be  sampled every 100 timesteps for 1000 times (100, 200, 300, etc.). The averages are then calculated 100,000 timesteps, however as our simulation runs for the same amount of time, only a single average is produced with these parameters.&lt;br /&gt;
&lt;br /&gt;
The timestep chosen for this simulation was 0.0025. Thus, the simulation will run for &amp;lt;math&amp;gt;100000 \times 0.0025 = 250 \text{ unit time}&amp;lt;/math&amp;gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580469</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580469"/>
		<updated>2017-02-06T12:12:04Z</updated>

		<summary type="html">&lt;p&gt;Az1114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580468</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580468"/>
		<updated>2017-02-06T12:11:20Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Running the Simulation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions (NpT) ==&lt;br /&gt;
&lt;br /&gt;
=== Temperature and Pressure Control ===&lt;br /&gt;
A timestep of 0.0025 was chosen as it is a good comprimise between accuracy of simulation and the length at which the simulation can run.&lt;br /&gt;
The following Temperatures are pressures were chosen as were about the equilibration values:&lt;br /&gt;
T: 1.5, 1.6, 1.7, 1.8, 1.9&lt;br /&gt;
P: 2.45, 2.65&lt;br /&gt;
&lt;br /&gt;
In the simulation, the temperature was controlled deducing the (fluctuaing) instantaneous temperature &amp;lt;math&amp;gt;T,&amp;lt;/math&amp;gt; using the following equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;E_K = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T \qquad\qquad\qquad(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order for &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; to reach our target temperature &amp;lt;math&amp;gt;\mathfrak{T},&amp;lt;/math&amp;gt; we introduce a constant &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; that controls the particles&#039; velocities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}\qquad\qquad(2)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus we can solve for &amp;lt;math&amp;gt;\gamma.&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;math&amp;gt;(2)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2\sum_i m_i v_i^2 = 3N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then substituting &amp;lt;math&amp;gt;\sum_i m_i v_i^2&amp;lt;/math&amp;gt; from &amp;lt;math&amp;gt;(1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma^2 3 N k_b T = 3N k_b \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma = \sqrt{\frac{\epsilon}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580463</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580463"/>
		<updated>2017-02-06T12:02:23Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Equilibration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580462</id>
		<title>Rep:Mod:Az1114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:Az1114&amp;diff=580462"/>
		<updated>2017-02-06T12:02:06Z</updated>

		<summary type="html">&lt;p&gt;Az1114: /* Equilibration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;TASK: Open the file HO.xls. In it, the velocity-Verlet algorithm is used to model the behaviour of a classical harmonic oscillator. Complete the three columns &amp;quot;ANALYTICAL&amp;quot;, &amp;quot;ERROR&amp;quot;, and &amp;quot;ENERGY&amp;quot;: &amp;quot;ANALYTICAL&amp;quot; should contain the value of the classical solution for the position at time t, &amp;quot;ERROR&amp;quot; should contain the absolute difference between &amp;quot;ANALYTICAL&amp;quot; and the velocity-Verlet solution (i.e. ERROR should always be positive -- make sure you leave the half step rows blank!), and &amp;quot;ENERGY&amp;quot; should contain the total energy of the oscillator for the velocity-Verlet solution. Remember that the position of a classical harmonic oscillator is given by  x\left(t\right) = A\cos\left(\omega t + \phi\right) (the values of A, \omega, and \phi are worked out for you in the sheet).&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For the default timestep value, 0.1, estimate the positions of the maxima in the ERROR column as a function of time. Make a plot showing these values as a function of time, and fit an appropriate function to the data.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TASK: For a single Lennard-Jones interaction, \phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right), find the separation, r_0, at which the potential energy is zero. What is the force at this separation? Find the equilibrium separation, r_{eq}, and work out the well depth (\phi\left(r_{eq}\right)). Evaluate the integrals \int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r, \int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r, and \int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r when \sigma = \epsilon = 1.0.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Lennard-Jones Potential ===&lt;br /&gt;
The below equation calculates the Leonard-Jones potential:&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)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By equating this to 0, we find that the &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt; - the separation at which the potential is 0 - is &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
We can then find the force at this separation by differentiating the Lennard-Jones potential with respect to r, and substituting in the value &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;:&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;
&amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}=\mathbf{F}=-24\epsilon \left(\frac{2 \sigma^{12}}{r^{13}}-\frac{\sigma^6}{r^7}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-24 \frac{\epsilon}{\sigma}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The equilibrium separation (&amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;) is the separation of the particles at equilibrium, and represents the distance that represents the minimum in potential energy. It can therefore be found by equating the force to zero &amp;lt;math&amp;gt;\frac{\mathrm{d}\phi}{\mathrm{d}r}&amp;lt;/math&amp;gt;, (or &amp;lt;math&amp;gt;\mathbf{F}&amp;lt;/math&amp;gt;) to 0.&lt;br /&gt;
&lt;br /&gt;
Hence,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\mathbf{F}=-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;r_{eq}=\sqrt[6]{2\sigma^6}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; back into &amp;lt;math&amp;gt;\phi(r)&amp;lt;/math&amp;gt; gives us the well depth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi(r_{eq})=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To put this equation into perspective, let us calculate the L-J potential for some realistic cutoff values:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\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)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&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&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=\lim_{r\rightarrow \infty} 4 \left(\frac{1^{12}}{11r^{11}}-\frac{1^6}{5r^5}\right) - 4\left(\frac{1^{12}}{11\times 2^{11}}+\frac{1^6}{5\times 2^5}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=0-0.024822\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.0248&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following the same calculations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0081767\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00818&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;=-0.0032901\cdots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\approx -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The calculations show that as the cutoff distance increases, the Lennard-Jones potential decreases, which agrees with the theory.&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
It is very difficult to simulate realistic volumes of liquid and in the scope of this experiment, we have simulated liquids with N (number of atoms) between 1,000 and 10,000. To demonstrate why simulating realistic volumes of liquid is difficult, let us first calculate the number of molecules in 1ml of water:&lt;br /&gt;
&lt;br /&gt;
(Assuming: Standard conditions; Density of water = 1.00 g/ml)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;1.00 \mathrm{ml} = 1.00 \mathrm{g}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;18.02 \mathrm{g/mol} = 0.0555 \text{ mols of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.0555 \times 6.022 \times 10^{23} = 3.34 \times 10^{22} \text{ molecules of water.}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, 10,000 water molecules is only &amp;lt;math&amp;gt;2.99 \times 10^{-19} \text{ ml of water}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the simulation to be completed in a reasonable amount of time, the atoms in the simulation are placed in a box with boundary conditions. The box is repeated in all direction, similar to a unit cell in a lattice. If an atom moves outside of the box, another will enter the box from the opposite side, maintaining the same number of atoms in the box.&lt;br /&gt;
&lt;br /&gt;
For example, if an atom at position &amp;lt;math&amp;gt;(0.5, 0.5, 0.5)&amp;lt;/math&amp;gt; in a cube of dimensions &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; moves along the vector &amp;lt;math&amp;gt;(0.7, 0.6, 0.2)&amp;lt;/math&amp;gt;, its final position would be &amp;lt;math&amp;gt;(0.2, 0.1, 0.7)&amp;lt;/math&amp;gt;, assuming the periodic boundary conditions have been upheld.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
The LAMMPS calculations run in this experiment are all done in reduced units&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma=0.34 \mathrm{nm}&amp;lt;/math&amp;gt;; &amp;lt;math&amp;gt;\epsilon/k_B=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If we set the cutoff to be &amp;lt;math&amp;gt;r*=3.2,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;r=3.2\times0.34=1.088\mathrm{nm}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Well depth: &amp;lt;math&amp;gt;\epsilon=120K\times k_B \times 6.02 \times 10^{23}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon=0.998 \mathrm{kJ/mol}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reduced temperature &amp;lt;math&amp;gt;T*=1.5&amp;lt;/math&amp;gt; would be &amp;lt;math&amp;gt;T=1.5 \times 120=180\mathrm{K}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
When initiating the simulation, the atoms are given regular spacing intervals like that found in a square lattice. They are not given random positions, as if by chance two atoms occupy the same space, the program will encounter error.&lt;br /&gt;
&lt;br /&gt;
For a simple cubic lattice (thus having 1 lattice point per unit cell) with number density 0.8:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.8 \text{ points/volume}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sqrt[3]{0.8}=0.9283\text{ points/length}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;0.9283^{-1}=1.0772 \text{ length/point}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Therefore the spacing between atoms is 1.0772 unit lengths (in reduced units).&lt;br /&gt;
&lt;br /&gt;
Giving the same treatment to a face-centred cubic lattice (4 lattice points/unit cell) with a number density of 1.2 will have a spacing of &amp;lt;math&amp;gt;0.5928&amp;lt;/math&amp;gt; as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\ \sqrt[3]{4.8^{-1}}=0.5928&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition, the simple cubic lattice with a density of 0.8 would create 1,000 atoms in the given constraints of the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;region box block 0 10 0 10 0 10&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and a face centred cubic lattice with a density of 1.2 would create 4,000 atoms in the same box.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
The input script contained a the following commands:&lt;br /&gt;
&amp;lt;pre&amp;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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mass command takes two arguments, setting the mass of type 1 atoms as &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; (still in reduced units).&lt;br /&gt;
The second line defines the type of interaction between the atoms (above set to &#039;lj&#039; for Leonard-Jones); with a cutoff distance of &amp;lt;math?3.0&amp;lt;/math&amp;gt; units.&lt;br /&gt;
The third line defines the values for the Leonard-Jones interactions, the former &amp;lt;math&amp;gt;1.0&amp;lt;/math&amp;gt; setting the well depth &amp;lt;math&amp;gt;epsilon&amp;lt;/math&amp;gt; and the latter sets &amp;lt;math&amp;gt;sigma&amp;lt;/math&amp;gt;. The two asterisks tell the program that this applies to all atoms in the system.&lt;br /&gt;
&lt;br /&gt;
Once the properties of the particles are set, the initial positions and velocities are defined. As we have both the &amp;lt;math&amp;gt;\mathbf{x}_i(0)&amp;lt;/math&amp;gt; &amp;amp; &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, the Velocity-Verlet integration half-step algorithm can be used.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
In the following lines from the input script:&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;
&lt;br /&gt;
We created and set a variable named &#039;timestep&#039; to 0.001, and used that value to calculate how many runs (${n_steps}) to carry out. This is superior to writing&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;
This allows us only to change the value of the timestep variable to alter the number of runs, rather than having to calculate ${n_steps} each time the timestep is altered, especially in cases such as this computational experiment where the timestep can be changed multiple times.&lt;br /&gt;
&lt;br /&gt;
===Equilibration===&lt;br /&gt;
&lt;br /&gt;
The following 3 graphs check whether the system&#039;s total energy, temperature, and pressure (respectively), equilibrate over time during the 0.001 time-step simulation.&lt;br /&gt;
y-axis values are in reduced units.&lt;br /&gt;
[[File:Total Energyaz.png]] [[File:Temperatureaz.png]] [[File:Pressureaz.png]]&lt;br /&gt;
&lt;br /&gt;
The following figure shows how total energy varies with time for many different timesteps. Note how at a large timestep of 0.15, the temperature actually diverges! Thus very high timesteps should not be used do to inaccuracies that can accrue.&lt;br /&gt;
[[File:Different Timesteps.png]]&lt;/div&gt;</summary>
		<author><name>Az1114</name></author>
	</entry>
</feed>