<?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=Sfs114</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=Sfs114"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Sfs114"/>
	<updated>2026-04-19T10:36:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574362</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574362"/>
		<updated>2016-12-15T18:35:04Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Mean Squared Displacement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur, while lower pressures would theoretically behave more as an ideal gas would. For the same reason, error decreases at higher temperatures.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations. Alternatively, increasing temperature causes a decrease in band gap, requiring less energy to enter excited states and thus lowering heat capacity.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD as a function of time of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD as a function of time of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD as a function of time of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally smaller. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574354</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574354"/>
		<updated>2016-12-15T18:29:00Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur, while lower pressures would theoretically behave more as an ideal gas would. For the same reason, error decreases at higher temperatures.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations. Alternatively, increasing temperature causes a decrease in band gap, requiring less energy to enter excited states and thus lowering heat capacity.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally smaller. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574332</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574332"/>
		<updated>2016-12-15T18:11:06Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Calculating Heat Capacities Using Statistical Physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations. Alternatively, increasing temperature causes a decrease in band gap, requiring less energy to enter excited states and thus lowering heat capacity.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally smaller. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574330</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574330"/>
		<updated>2016-12-15T18:10:02Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Calculating Heat Capacities Using Statistical Physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations. Alternatively, increasing temperature causes a decrease in band gap, making it easier to enter excited states and thus lowering heat capacity.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally smaller. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574309</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574309"/>
		<updated>2016-12-15T17:59:29Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally smaller. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574307</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574307"/>
		<updated>2016-12-15T17:58:04Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574303</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574303"/>
		<updated>2016-12-15T17:54:52Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Checking Equilibriation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.001 results in a very similar equilibriation, so going this small is not necessary. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574297</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574297"/>
		<updated>2016-12-15T17:51:44Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as &amp;lt;math&amp;gt;\plusmn 1%&amp;lt;/math&amp;gt; of the average value.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574294</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574294"/>
		<updated>2016-12-15T17:50:04Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574292</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574292"/>
		<updated>2016-12-15T17:48:03Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574291</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574291"/>
		<updated>2016-12-15T17:47:46Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
The trapezium rule estimation of the integral for a solid was found to be -0.416 for 1000000 atoms between 0 and 500. (D would hypothetically equal -0.139)&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574269</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574269"/>
		<updated>2016-12-15T17:34:40Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 18-12=6 neighbours), and 24 (Int(g(1.775)=42, 42-18=24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.41626945400000459 = 0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574265</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574265"/>
		<updated>2016-12-15T17:31:57Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle, indicated by decreasing heights of peaks.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.41626945400000459 = 0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574264</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574264"/>
		<updated>2016-12-15T17:30:59Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475. This agrees well with the original input density of 1.3 (which should result in a lattice spacing of 1.45).&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.41626945400000459 = 0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nearestn3.jpg&amp;diff=574263</id>
		<title>File:Nearestn3.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nearestn3.jpg&amp;diff=574263"/>
		<updated>2016-12-15T17:30:00Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574261</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574261"/>
		<updated>2016-12-15T17:29:42Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn3.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.41626945400000459 = 0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574248</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574248"/>
		<updated>2016-12-15T17:22:23Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Periodic Boundary Conditions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at &#039;&#039;&#039;(0.2,0.1,0.7)&#039;&#039;&#039; once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.41626945400000459 = 0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574240</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574240"/>
		<updated>2016-12-15T17:19:07Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.41626945400000459 = 0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint9.jpg&amp;diff=574238</id>
		<title>File:Runint9.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint9.jpg&amp;diff=574238"/>
		<updated>2016-12-15T17:18:06Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint8.jpg&amp;diff=574237</id>
		<title>File:Runint8.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint8.jpg&amp;diff=574237"/>
		<updated>2016-12-15T17:17:42Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint7.jpg&amp;diff=574235</id>
		<title>File:Runint7.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint7.jpg&amp;diff=574235"/>
		<updated>2016-12-15T17:17:07Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574232</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574232"/>
		<updated>2016-12-15T17:16:41Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Diffusion coefficient estimations, using the trapezium rule:&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint5.jpg|thumb|centre|Plot of running integral of VACF of a liquid]]&lt;br /&gt;
[[File:runint6.jpg|thumb|centre|Plot of running integral of VACF of a gas]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg|thumb|centre|800px|A plot of total VACF against &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt; for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint7.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint8.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
[[File:runint9.jpg|thumb|centre|Plot of running integral of VACF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574221</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574221"/>
		<updated>2016-12-15T17:11:06Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|centre|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|centre|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574218</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574218"/>
		<updated>2016-12-15T17:10:33Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Mean Squared Displacement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|left|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|right|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
[[File:solid.jpg|thumb|centre|Total MSD of simulated solid]]&lt;br /&gt;
[[File:liquid1.jpg|thumb|centre|Total MSD of simulated liquid]]&lt;br /&gt;
[[File:gas11.jpg|thumb|centre|Total MSD of simulated gas]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg|thumb|800px|Total MSD as a function of time for 1000000 atoms]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574215</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574215"/>
		<updated>2016-12-15T17:06:09Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|left|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|right|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574213</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574213"/>
		<updated>2016-12-15T17:05:39Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
[[File:nearestn.jpg|thumb|right|400px|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|right|250px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|left|600px|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nearestn2.jpg&amp;diff=574212</id>
		<title>File:Nearestn2.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nearestn2.jpg&amp;diff=574212"/>
		<updated>2016-12-15T17:03:17Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574211</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574211"/>
		<updated>2016-12-15T17:02:51Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. &lt;br /&gt;
[[File:nearestn.jpg|thumb|left|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn2.jpg|thumb|right|200px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nearestn1.jpg&amp;diff=574209</id>
		<title>File:Nearestn1.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nearestn1.jpg&amp;diff=574209"/>
		<updated>2016-12-15T17:01:32Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: Sfs114 uploaded a new version of File:Nearestn1.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574208</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574208"/>
		<updated>2016-12-15T17:01:13Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Structural Properties and the Radial Distribution Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg|thumb|centre|800px|A plot of RDFs]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. &lt;br /&gt;
[[File:nearestn.jpg|thumb|left|A diagram of first  (left) and second (right) nearest neighbours (shown in blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
[[File:nearestn1.jpg|thumb|right|200px|A diagram of third nearest neighbours (blue) with respect to a reference particle (red) in an FCC lattice (other atoms shown in black)]]&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg|thumb|centre|A plot of the running integral of the RDF of a solid]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574196</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574196"/>
		<updated>2016-12-15T16:43:47Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Calculating Heat Capacities Using Statistical Physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg|thumb|centre|800px|A plot of heat capacity/volume against temperature]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574191</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574191"/>
		<updated>2016-12-15T16:40:36Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg|thumb|center|800px|A plot of density against temperature compared to ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574185</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574185"/>
		<updated>2016-12-15T16:30:27Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Checking Equilibriation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|left|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|right|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574180</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574180"/>
		<updated>2016-12-15T16:29:48Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Checking Equilibriation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg|thumb|400px|right|Energy equilbriation]] &lt;br /&gt;
[[File:energyeqzoom.jpg|thumb|400px|left|Closer look at energy equilibriation]]&lt;br /&gt;
[[File:tempeq.jpg|thumb|400px|left|Temperature equilbriation]]&lt;br /&gt;
[[File:tempeqzoom.jpg|thumb|400px|right|Closer look at temperature equilibriation]]&lt;br /&gt;
[[File:presseq.jpg|thumb|400px|left|Pressure equilbriation]]&lt;br /&gt;
[[File:presseqzoom.jpg|thumb|400px|right|Closer look at pressure equilibriation]]&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg|thumb|800px|centre|Energy equilibriation for multiple timesteps]]&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy drifts; diverging instead of converging to an average value.&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574147</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574147"/>
		<updated>2016-12-15T15:52:47Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimal timesteps greatly increase time needed to run simulations. Larger timesteps allow a longer length of time to be simulated. A timestep of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|centre|600px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574133</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574133"/>
		<updated>2016-12-15T15:46:48Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Theory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|left|450px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|right|450px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574132</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574132"/>
		<updated>2016-12-15T15:46:06Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|left|450px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|right|450px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574129</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574129"/>
		<updated>2016-12-15T15:42:29Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. Calculations over larger timesteps causes a greater error, as particles could end up too close together and face extremely large forces, for example. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|left|450px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
[[File:energytimestep2.jpg|thumb|right|450px|Energy oscillation with a timestep of 0.5s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Energytimestep2.jpg&amp;diff=574115</id>
		<title>File:Energytimestep2.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Energytimestep2.jpg&amp;diff=574115"/>
		<updated>2016-12-15T15:24:37Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Energytimestep.jpg&amp;diff=574104</id>
		<title>File:Energytimestep.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Energytimestep.jpg&amp;diff=574104"/>
		<updated>2016-12-15T15:12:17Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574103</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574103"/>
		<updated>2016-12-15T15:11:46Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
[[File:energytimestep.jpg|thumb|centre|800px|Energy oscillation with a timestep of 0.028s]]&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574101</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574101"/>
		<updated>2016-12-15T15:08:08Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|centre|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|centre|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|centre|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574098</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574098"/>
		<updated>2016-12-15T15:06:35Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|thumb|800px|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg|thumb|800px|A plot of energy against time]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg|thumb|800px|A plot of absolute error, with a linear function fitted to the error maxima]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574095</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=574095"/>
		<updated>2016-12-15T15:00:21Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* Numerical Integration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg|A plot of x(t) against t comparing analytical and velocity-Verlet solutions]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=573700</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=573700"/>
		<updated>2016-12-14T19:54:14Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;br /&gt;
&lt;br /&gt;
The estimated diffusion coefficients for the two simulations follow the same trend and agree quite well, however the values obtained for the larger 1000000 atom simulations are generally larger. The largest sources of error include the trapezium rules used to calculate the integral and the simulation assumption that velocities do not change upon collisions.&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint3.jpg&amp;diff=573698</id>
		<title>File:Runint3.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint3.jpg&amp;diff=573698"/>
		<updated>2016-12-14T19:49:41Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: Sfs114 uploaded a new version of File:Runint3.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint2.jpg&amp;diff=573697</id>
		<title>File:Runint2.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint2.jpg&amp;diff=573697"/>
		<updated>2016-12-14T19:49:06Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: Sfs114 uploaded a new version of File:Runint2.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint4.jpg&amp;diff=573696</id>
		<title>File:Runint4.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Runint4.jpg&amp;diff=573696"/>
		<updated>2016-12-14T19:48:39Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: Sfs114 uploaded a new version of File:Runint4.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=573694</id>
		<title>Rep:Mod:sfs114</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:sfs114&amp;diff=573694"/>
		<updated>2016-12-14T19:48:12Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: /* 1000000 Atoms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Theory ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical Integration ===&lt;br /&gt;
&lt;br /&gt;
The classical solution for the position at time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; compares well with the velocity-Verlet solution:&lt;br /&gt;
&lt;br /&gt;
[[File:Classicalsolution1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The total energy for the oscillator varies as shown:&lt;br /&gt;
&lt;br /&gt;
[[File:Energy111.jpg]]&lt;br /&gt;
&lt;br /&gt;
An approximate linear fit has been performed on the maxima of the error of the calculations; the absolute difference between classical and velocity-Verlet solutions. Iterations of using previous results causes error to propagate and increase. &lt;br /&gt;
&lt;br /&gt;
[[File:Errorfit.jpg]]&lt;br /&gt;
&lt;br /&gt;
The smaller the timestep, the smaller fluctuations in total energy. It is important to monitor the total energy of a physical system to ensure energy is conserved, however infinitesimally small timesteps greatly increase time needed to run simulations. A time step of &#039;&#039;&#039;0.028s&#039;&#039;&#039; allows energy fluctuations to be as low as 1% and this is a good trade off with simulation run time.&lt;br /&gt;
&lt;br /&gt;
=== Atomic Forces ===&lt;br /&gt;
&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi (r) = 4\epsilon (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:* When potential energy is 0, &amp;amp;phi;(r) = 0 and r=r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
::If &amp;lt;math&amp;gt;\phi=0, (\frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6}) = 0&amp;lt;/math&amp;gt;,&lt;br /&gt;
:::&amp;lt;math&amp;gt;\frac{\sigma^{12}}{r^{12}} = \frac{\sigma^{6}}{r^{6}}&amp;lt;/math&amp;gt;&lt;br /&gt;
:::&amp;lt;math&amp;gt;r_0 = \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*The force is given by &amp;lt;math&amp;gt;F= \frac{d\phi}{dr}=4\epsilon(-12\sigma^{12}r^{-13}+6\sigma^{6}r^{-7})&amp;lt;/math&amp;gt; and at a potential energy of 0, &amp;lt;math&amp;gt;F=\frac{-24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\frac{d\phi}{dr}=0&amp;lt;/math&amp;gt;.&lt;br /&gt;
::&amp;lt;math&amp;gt;0=4\epsilon(\frac{-12\sigma^{12}}{r^{13}}+\frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;(\frac{12\sigma^{12}}{r^{13}} = \frac{6\sigma^6}{r^7})&amp;lt;/math&amp;gt;&lt;br /&gt;
::&amp;lt;math&amp;gt;r_{eq}=2^{\frac{1}{6}}\sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*At equilibrium separation, the well depth:&lt;br /&gt;
::&amp;lt;math&amp;gt;\phi(r_{eq})=\phi(2^{\frac{1}{6}}\sigma)=-\epsilon&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*&amp;lt;math&amp;gt;\int\phi(r)\, dr=4\epsilon[\frac{-\sigma^{12}}{11r^{11}}+\frac{\sigma^6}{5r^5}]+c&amp;lt;/math&amp;gt; and given that &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt; so &amp;lt;math&amp;gt;\int\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]+c&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_2^{\infty} = -4(\frac{1}{5(2)^5}-\frac{1}{11(2)^{11}}) = -0.02482&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{2.5\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{2.5}^{\infty} = -4(\frac{1}{5(2.5)^5}-\frac{1}{11(2.5)^{11}}) = -0.008177&amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt;\int\limits_{3\sigma}^{\infty}\phi(r)\, dr=4\left[\frac{-1}{11r^{11}}+\frac{1}{5r^5}\right]_{3}^{\infty} = -4(\frac{1}{5(3)^5}-\frac{1}{11(3)^{11}}) = -0.00329&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Periodic Boundary Conditions ===&lt;br /&gt;
&lt;br /&gt;
As &amp;lt;math&amp;gt; pV=Nk_BT &amp;lt;/math&amp;gt;, the number of water molecules in 1 mL of water is approximately &amp;lt;math&amp;gt;2.46x10^{19}&amp;lt;/math&amp;gt; and 10000 molecules takes up an approximate volume of &amp;lt;math&amp;gt;4.06x10^{-22} m^3&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a simulation box which runs from (0,0,0) to (1,1,1), an atom that starts at (0.5,0.5,0.5) and moves along vector (0.7,0.6,0.2), will end up at (0.2,0.1,0.7) once periodic boundary conditions have been applied.&lt;br /&gt;
&lt;br /&gt;
=== Reduced Units ===&lt;br /&gt;
&lt;br /&gt;
The LJ parameters for Argon are: &amp;lt;math&amp;gt;\sigma=0.34nm, \frac{\epsilon}{k_B}=120K&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;r=\sigma \cdot r*= 0.34 \cdot 3.2 = 1.088 nm&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt; Well Depth = \phi(r_{eq}) = - \epsilon = - k_B \cdot 120 = -1.656^{-21}J&amp;lt;/math&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt;-1.656^{-21} \cdot N_A = -997.4 = -0.997 kJ mol^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
*&amp;lt;math&amp;gt;T=\frac{\epsilon \cdot T*}{k_B}=120 \cdot 1.5 = 180 K&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Equilibriation ==&lt;br /&gt;
&lt;br /&gt;
=== Creating the Simulation Box ===&lt;br /&gt;
&lt;br /&gt;
If two atoms are generated too close together, the LJ potential shows that the potential between the two would be infinitely large, making force simulations between these two atoms too large to realistically simulate. The LJ cutoff also ensures that LJ potentials are only calculated for atoms that are near enough, and not every other atom in the infinitely repeating lattice, which would greatly increase simulation run time.&lt;br /&gt;
&lt;br /&gt;
A lattice spacing of 1.07722 corresponds to a lattice number density of &amp;lt;math&amp;gt;\frac{1}{1.07722^3}=0.8&amp;lt;/math&amp;gt; for a simple cubic lattice. A face centred cubic lattice has 4 lattice points per cell, and thus would require a lattice spacing of &amp;lt;math&amp;gt; (\frac{4}{1.2})^{\frac{1}{3}}= 1.4938&amp;lt;/math&amp;gt;. A 10x10x10 box would contain 1000 unit cells, and 4000 lattice points, so the create_atoms command for such a lattice would create 4000 atoms.&lt;br /&gt;
&lt;br /&gt;
=== Setting the Properties of the Atoms ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039; assigns all atoms of type 1 a mass of 1.0.&lt;br /&gt;
The command &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039; defines the cutoff distance between atoms that have a potential between them to be 3.0 (ie. the simulation does not run for atoms farther apart or closer than this distance).&lt;br /&gt;
The command &#039;&#039;&#039;pair_coeff ** 1.0 1.0&#039;&#039;&#039; specifically defines the pairwise force field coefficients for multiple pairs atoms.&lt;br /&gt;
&lt;br /&gt;
The velocity-Verlet algorithm is the numerical integration method that will be used if &amp;lt;math&amp;gt;x_i(0)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v_i(0)&amp;lt;/math&amp;gt; are defined.&lt;br /&gt;
&lt;br /&gt;
=== Running the Simulation ===&lt;br /&gt;
&lt;br /&gt;
Calling upon variables, instead of assigning numbers, makes it much easier to change these variables for every simulation that is run.&lt;br /&gt;
&lt;br /&gt;
=== Checking Equilibriation ===&lt;br /&gt;
&lt;br /&gt;
The simulation takes about 0.3 seconds to equilibriate energy, temperature, and pressure, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:energyeq.jpg]]&lt;br /&gt;
[[File:energyeqzoom.jpg]]&lt;br /&gt;
[[File:tempeq.jpg]]&lt;br /&gt;
[[File:tempeqzoom.jpg]]&lt;br /&gt;
[[File:presseq.jpg]]&lt;br /&gt;
[[File:presseqzoom.jpg]]&lt;br /&gt;
&lt;br /&gt;
Of the five timsteps used, 0.0025 is the largest acceptable timestep to use as a smaller timestep of 0.01 results in a very similar equilibriation. 0.015 does not equilbriate at all as the time steps are too large for the numerical integration to accurately find an average for the ensemble, and energy accumulates.&lt;br /&gt;
&lt;br /&gt;
[[File:Equilibriation3.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Running Simulations Under Specific Conditions ==&lt;br /&gt;
&lt;br /&gt;
=== Thermostats &amp;amp; Barostats ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E_K = \frac{3}{2} Nk_B\mathfrak{T} = \frac{1}{2}\sum_{i} m_i (\gamma v_i)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{1}{2}\sum_{i}m_i v_i^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma^2 = \frac{\frac{3}{2}Nk_B\mathfrak{T}}{\frac{3}{2}Nk_BT}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt; \gamma = (\frac{\mathfrak{T}}{T})^\frac{1}{2} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Examining the Input Script ===&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;fix aves all ave/time 100 1000 100000&#039;&#039;&#039; means that values will be sampled every 100 timesteps; in total 1000 readings will be taken to compute a final average on the 100000th timestep.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;run 100000&#039;&#039;&#039; indicates that 100000 timesteps will be simulated.&lt;br /&gt;
&lt;br /&gt;
=== Plotting the Equations of State ===&lt;br /&gt;
[[File:download1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressures lead to higher densities, both in theory and in these simulations. Our simulated density is higher than that given by the ideal gas law because the simulation takes particle interactions into account. The error increases at higher pressures, when more collisions are likely to occur.&lt;br /&gt;
&lt;br /&gt;
== Calculating Heat Capacities Using Statistical Physics ==&lt;br /&gt;
[[File:HEATCAP.jpg]]&lt;br /&gt;
&lt;br /&gt;
Higher pressure results in higher heat capacity as the increased number of molecules per unit volume that can absorb energy to their vibrational excited states. As the simulation is in a lattice, rotational degrees of freedom are not available to the atoms, and so heat capacity decreases as temperature increases, despite expectations.&lt;br /&gt;
&lt;br /&gt;
An example of the input scripts is below:&lt;br /&gt;
&lt;br /&gt;
[[Media:inputnpt.in]]&lt;br /&gt;
&lt;br /&gt;
== Structural Properties and the Radial Distribution Function ==&lt;br /&gt;
[[File:RDF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The RDF shows the probability of finding a particle at a distance r from a reference particle, relative to an ideal gas. In a gas, there is little order and minimal structure to particles and so the graph has minimal features. &lt;br /&gt;
&lt;br /&gt;
Liquids are slightly more ordered and the decreasing heights of peaks of the RDF correlate to coordination spheres. There is a high probability of finding another particle in a primary coordination sphere but this probability decreases as you go farther away from the reference particle.&lt;br /&gt;
&lt;br /&gt;
The solid FCC lattice has a much higher order, and the RDF peak separation and heights define the lattice structure. The first, second, and third sharp peaks refer to different sets of nearest neighbours, while their heights show how many of those nearest neighbours there are. The lattice spacing is the same as the distance to the second nearest neighbour, 1.475.&lt;br /&gt;
&lt;br /&gt;
The following images show a reference particle in red and first, second, and third nearest neighbouring particles respectively. The rest of the lattice is shown in black.&lt;br /&gt;
[[File:nearestn.jpg]]&lt;br /&gt;
[[File:nearestn1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The coordination numbers are 12 (Int(g(1.205)=12, 12 neighbours), 6 (Int(g(1.475)=18, 6 neighbours), and 24 (Int(g(1.775)=42, 24 neighbours) respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:Int1.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Dynamical Properties and the Diffusion Coefficient ==&lt;br /&gt;
&lt;br /&gt;
=== Mean Squared Displacement ===&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 0.00382752458475 = 6.38x10^{-4}&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:solid.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.509774821123 = 0.085&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:liquid1.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 7.99193006423 = 1.33&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:gas11.jpg]]&lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient increases as entropy of the phase increases, which matches expectations as gas particles are much more likely to diffuse than a rigid lattice of solid molecules.&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
&lt;br /&gt;
[[File:MSD11.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{6} \cdot 2.79195534196x10^5 = 4.65x10^{-6} &amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{6} \cdot 0.531614512766 = 0.0886&amp;lt;/math&amp;gt;&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{6} \cdot 18.0968139669 = 3.02&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The MSD graph for a gas is curved at first, indicating ballistic motion proportional to &amp;lt;math&amp;gt;T^{2}&amp;lt;/math&amp;gt;. After enough collisions have occurred, diffusion is linear, as it is for a liquid which constantly has the same collisions. The diffusion coefficient is close to 0 for solids which is as expected.&lt;br /&gt;
&lt;br /&gt;
=== Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; x(t)=Acos(\omega t + \phi) &amp;lt;/math&amp;gt;   and   &amp;lt;math&amp;gt; v(t) = \frac{dx(t)}{dt} = -A\omega sin (\omega t+ \phi) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\int\limits_{-\infty}^{\infty}v(t)-v(t+\tau)dt}{\int\limits_{-\infty}^{\infty}v^2(t)dt} =  \frac{\int\limits_{-\infty}^{\infty}sin(\omega t+\phi)sin(\omega(t+\tau)+\phi)}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin(A+B) = sinAcosB + cosAsinB &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} sin^2(\omega t + \phi) dt] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty}sin^2(\omega t + \phi)dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; sin^2(x) = \frac{1}{2} (1-cos(2x)) &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{[cos (\omega \tau) \int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi)] + [sin (\omega \tau) \int\limits_{-\infty}^{\infty} sin(\omega t + \phi) cos(\omega t + \phi) dt]}{\int\limits_{-\infty}^{\infty} \frac{1}{2} (1-cos(2(\omega t + \phi) dt} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int \frac{1}{2} (1-cos(2(\omega t + \phi)) dt = \frac{t}{2} + \frac{sin(2(\omega t + \phi)}{4\omega} + c &amp;lt;/math&amp;gt;&lt;br /&gt;
::*&amp;lt;math&amp;gt; \int sin(\omega t + \phi) cos(\omega t + \phi) dt = \frac{sin^2(\omega t + \phi)}{2\omega} + c&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\left[\frac{tcos(\omega \tau)}{2} + \frac{cos(\omega \tau)sin(2(\omega t + \phi))}{4\omega} + \frac{sin(\omega \tau)sin^2(\omega t + \phi)}{2\omega}\right]_{-\infty}^{\infty}}{\left[\frac{t}{2} +  \frac{sin(2(\omega t + \phi)}{4\omega}  \right]_{-\infty}^{\infty}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::*sin(x) is an odd function and integrating between &amp;lt;math&amp;gt;-\infty&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\infty&amp;lt;/math&amp;gt; will result in 0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; C(\tau) = \frac{\frac{tcos(\omega \tau)}{2}}{\frac{t}{2}} = cos (\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
VACF minima refer to collisions of particles where velocity is instantaneously 0, negative as they are in the opposite direction to &amp;lt;math&amp;gt;\tau&amp;lt;/math&amp;gt;. As VACF is averaged over all molecules, they cancel out once they are out of phase, which happens faster for liquids than it does for solids. In comparison to the harmonic oscillator, which only models one particle without any collisions, no convergence to 0 occurs.&lt;br /&gt;
&lt;br /&gt;
[[File:VACF1.jpg]]&lt;br /&gt;
&lt;br /&gt;
Further diffusion coefficient estimations, using the trapezium rule, and running integrals are shown below:&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot 0.43184744815700105 = 0.144  &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint4.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 146.83331703729999 = 48.9 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint5.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1451.848385 =484 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint6.jpg]]&lt;br /&gt;
&lt;br /&gt;
==== 1000000 Atoms ====&lt;br /&gt;
[[File:VACF1111.jpg]]&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{solid} = \frac{1}{3} \cdot -0.41626945400000459 = -0.139&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint1.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{liquid} = \frac{1}{3} \cdot 123.7270701106= 41.2 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint2.jpg]]&lt;br /&gt;
*&amp;lt;math&amp;gt; D_{gas} = \frac{1}{3} \cdot 1466.443215 = 489 &amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:runint3.jpg]]&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:VACF1111.jpg&amp;diff=573690</id>
		<title>File:VACF1111.jpg</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:VACF1111.jpg&amp;diff=573690"/>
		<updated>2016-12-14T19:44:54Z</updated>

		<summary type="html">&lt;p&gt;Sfs114: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sfs114</name></author>
	</entry>
</feed>